py icon indicating copy to clipboard operation
py copied to clipboard

Normalise path before comparing on windows

Open patstew opened this issue 5 years ago • 3 comments

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.

patstew avatar Oct 02 '19 14:10 patstew

I don't think that test failure is due to this PR

patstew avatar Oct 02 '19 20:10 patstew

@patstew Can you add a test for it, please? (and rebase it then) Likely good to use the example from how pytest triggers it.

blueyed avatar Mar 31 '20 02:03 blueyed

Note: this semantically conflicts with #243. If #243 is merged, then this PR will need to also update __hash__.

bluetech avatar Jun 15 '20 10:06 bluetech