pytest-dev / py

Python development support library (note: maintenance only)
MIT License
67 stars 106 forks source link

[bug] ensurepath causes index errors if the path is empty #242

Closed jmrgibson closed 2 years ago

jmrgibson commented 4 years ago

I'm trying to embed pytest in an application binary (eg pyoxidize) https://github.com/indygreg/PyOxidizer/issues/69

In this case, I explicitly don't want to load any python modules from the file system (aside from when pytest collects tests) so sys.path is empty, which means this line https://github.com/pytest-dev/py/blob/master/py/_path/local.py#L643 causes an index error. Easily resolved by changing the line to if not sys.path or sys.path[0] != s

Would you like me to make a PR to change this?

RonnyPfannschmidt commented 2 years ago

modern pytest should no longer be using that, for this lib - maintenance only, its here to die