tox icon indicating copy to clipboard operation
tox copied to clipboard

PythonSpec.satisfies fails to compare paths with different notations

Open johannesloibl opened this issue 2 years ago • 6 comments

# tox/interpreters/py_spec.py:12

def satisfies(self, req):
    if req.is_abs and self.is_abs and self.path != req.path:
        return False

Comparing self.path to req.path it might happen that self.path is a path string with backslashes and rep.path might be a path string with frontslashes. In my case i am setting TOXPYTHON37 = C:/python.3.7.9/python.exe, so self.path is C:\python.3.7.9\python.exe and req.path is C:/python.3.7.9/python.exe.

This should be replaced by proper path comparison using pathlib or whatever.

Tox version is 3.25.0

johannesloibl avatar Jun 01 '22 22:06 johannesloibl

Thanks for this bug report.

Could you please test whether this issue still exists on the current pre-release?

pip install tox --pre

or

pip install tox==4.0.0b2

jugmac00 avatar Jun 02 '22 06:06 jugmac00

Seems to work, seems like there was a major overhaul :) Besides that on version 4.0.0b2 i can see other problems, don't know if they are known:

  1. Weird output characters in commandline when i execute tox image
  2. Support for environment files seems to have changed. Lines starting with the file| inside setenv are leading to a fail now: tox.report.HandledError: replace failed in py38-dev.basepython with ValueError("invalid line 'file|ci/tox_setenv.txt' in set_env")

johannesloibl avatar Jun 02 '22 07:06 johannesloibl

Thanks! Could you please create two new separate issues? Please include as much details about your terminal for the first issue, and a minimal reproducer for the second issue.

P.S.: And yes - tox 4 is a complete rewrite, with many many edge cases already fixed, but apparently not all :-) Especially not on Windows. Greatly appreciating your time to test it.

jugmac00 avatar Jun 02 '22 07:06 jugmac00

  1. Weird output characters in commandline when i execute tox

What terminal are you using, and what windows versions? Seems colours are not rendered by it.

gaborbernat avatar Jun 02 '22 09:06 gaborbernat

I'm using the commandline terminal of PyCharm 2021.2.1, which in other cases is able to render colors. Win10.

johannesloibl avatar Jun 02 '22 09:06 johannesloibl

Did you try with powershell and command prompt to see if you can replicate the issue?

gaborbernat avatar Jun 02 '22 17:06 gaborbernat

3.0 is no longer supported, please try with 4.0.

gaborbernat avatar Jun 20 '23 16:06 gaborbernat