py.path.local has a footgun flaw: __eq__ on Windows is case-insensitive, but __hash__ returns the hash of the strpath directly, meaning a == b does not imply hash(a) == hash(b). So things like this are possible:
import sys, py
assert sys.platform == "win32"
a = py.path.local("/some/path")
b = py.path.local("/some/PATH")
assert a == b # Passes
assert a in {b} # Fails
assert a in {b: 'b'} # Fails
This probably causes some subtle bugs in pytest, which uses several dicts & sets of py.path.locals. Since py is frozen, it's not possible to fix there.
I haven't checked it yet, but wanted to make a note for later.
py.path.localhas a footgun flaw:__eq__on Windows is case-insensitive, but__hash__returns the hash of thestrpathdirectly, meaninga == bdoes not implyhash(a) == hash(b). So things like this are possible:This probably causes some subtle bugs in pytest, which uses several dicts & sets of
py.path.locals. Sincepyis frozen, it's not possible to fix there.I haven't checked it yet, but wanted to make a note for later.