Exception importing conftest if the repo is on a Windows mapped network drive for pytest>=5.1.0 #5825
Labels
platform: windows
windows platform-specific problem
type: bug
problem that needs to be addressed
type: regression
indicates a problem that was introduced in a release which was working previously
Basic description
I've ran into an issue with executing tests using relative paths on pytest versions after 5.0.1: there is an
ImportMismatchError
when pytest attempts to import conftest.py. This occurs only if the codebase is on a Windows mapped network drive.I haven't checked on MacOS or Linux, but I have a feeling this doesn't affect them because it would have been reported earlier. (I searched open issues here and didn't find anything that this seems to duplicate - apologies if I overlooked something.)
This appears to be distinct from the issue reported in #5819, both by dint of the versions involved and the nature of the exceptions.
One thing I observe comparing the output from 5.1.2 (not working) and 5.0.1 (working) is the root dir:
5.1.2:
rootdir: \\giant\src\git\conftest-repro
5.0.1:
rootdir: K:\p\git\conftest-repro
pip list output
Platform info
OS version: Windows Server 2012R2
I've also reproduced this issue on 5.1.0. However, it fails to reproduce on 4.6.2 and 5.0.1.
Detailed description and repro info
I've created the repo https://github.com/paul-ko/conftest-repro to reproduce this issue. The structure of its Python code is as follows:
To set up for repro, do the following:
virtualenv venv
from the base directory of the repo)For the sake of this example, let's say you've cloned it to
K:\p\git\conftest-repro
, which corresponds to the network drive\\giant\src\git\conftest-repro
.To repro, simply run
pytest conftestrepro
from the base directory of the repository.You should see an exception like this:
You can avoid this issue in a few ways:
Omitting the path entirely bypasses this issue, but when I do that the custom argument declared in
conftest.py
is no longer usable.Output running after downgrading to 5.0.1:
The text was updated successfully, but these errors were encountered: