py
py copied to clipboard
Normalise path before comparing on windows
Without this change I get pytest errors on MSYS2 like this:
=================================== ERRORS ====================================
_______________ ERROR collecting test_x.py ________________
import file mismatch:
imported module 'f.test_x' has this __file__ attribute:
C:/path/to\f\test_x.py
which is not the same as the test file we want to collect:
C:/path/to/f/test_x.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.20 seconds ===========================
Removing __pycache__
or using PYTHONDONTWRITEBYTECODE=1
doesn't help.
This seems to be the same problem as #58 was trying to fix. I've moved it to __eq__
as suggested in the original PR on bitbucket.
I don't think that test failure is due to this PR
@patstew Can you add a test for it, please? (and rebase it then) Likely good to use the example from how pytest triggers it.
Note: this semantically conflicts with #243. If #243 is merged, then this PR will need to also update __hash__
.