pytest: ImportPathMismatchError when on UNC path
Windows: When running pytest on a directory mounted as UNC path, this fail with ImportPathMismatchError:
c:\vagrant>pytest tests\\functional\\test_path_encodings.py
pytest tests\\functional\\test_path_encodings.py
Adding c:\python38\lib\site-packages\pywin32_system32 to sys.path
ImportError while loading conftest 'c:\vagrant\tests\functional\conftest.py'.
_pytest.pathlib.ImportPathMismatchError: ('conftest', 'c:\\vagrant\\tests\\functional\\conftest.py', WindowsPath('c:/vagrant/tests/functional/conftest.py'))
How to reproduce
- Fire up a virtual maschine usine Vagrat and sharing the current directory (which contains the package)
- Intall Python, pytest and requiremnets
- Try running pytest
You can actually use the setup provided by PyInstaller:
git clone https://github.com/pyinstaller/pyinstaller.git
cd bootloader
# in Vagrantfile, line 434 (provision step "install packages") remove "vcbuildtools"
# … to save avoid installing this huge package
vagrant up --no-provision windows10
vagrant ssh windows10 # password is "Passw0rd!"
pip install -U pip
python -m pip install --upgrade pip setuptools wheel
pip install -U -r tests/requirements-tools.txt
pip install -e .
pytest tests/functional/test_path_encodings.py
C:\Users\IEUser>pip list Package Version Location
altgraph 0.17
apipkg 1.5
atomicwrites 1.4.0
attrs 20.1.0
colorama 0.4.3
execnet 1.7.1
flake8 3.8.3
future 0.18.2
iniconfig 1.0.1
lxml 4.5.2
mccabe 0.6.1
more-itertools 8.4.0
packaging 20.4
pefile 2019.4.18
pip 20.2.2
pluggy 0.13.1
psutil 5.7.2
py 1.9.0
pycodestyle 2.6.0
pyflakes 2.2.0
pyinstaller 4.1.dev0 \vboxsvr\vagrant
pyinstaller-hooks-contrib 2020.7
pyparsing 2.4.7
pytest 6.0.1
pytest-drop-dup-tests 0.3.0
pytest-forked 1.3.0
pytest-timeout 1.4.2
pytest-xdist 2.0.0
pywin32 228
pywin32-ctypes 0.2.0
setuptools 47.1.0
six 1.15.0
tinyaes 1.0.1
toml 0.10.1
System: Windows10, Python 3.8.5
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 29 (13 by maintainers)
Commits related to this issue
- WIP: check if paths are the same in pathlib.import_path Related to #7678 — committed to nicoddemus/pytest by nicoddemus 4 years ago
- Compare also paths on Windows when considering ImportPathMismatchError On Windows, os.path.samefile returns false for paths mounted in UNC paths which point to the same location. I couldn't reproduc... — committed to nicoddemus/pytest by nicoddemus 4 years ago
- Compare also paths on Windows when considering ImportPathMismatchError On Windows, os.path.samefile returns false for paths mounted in UNC paths which point to the same location. I couldn't reproduc... — committed to nicoddemus/pytest by nicoddemus 4 years ago
- Merge #14 #17 14: Update sphinx_rtd_theme to 0.5.1 r=aragilar a=pyup-bot This PR updates [sphinx_rtd_theme](https://pypi.org/project/sphinx_rtd_theme) from **0.5.0** to **0.5.1**. *The bot wasn'... — committed to aragilar/pytest-info-collector by bors[bot] 3 years ago
- Merge #17 17: Update pytest to 6.2.2 r=aragilar a=pyup-bot This PR updates [pytest](https://pypi.org/project/pytest) from **6.1.1** to **6.2.2**. <details> <summary>Changelog</summary> ... — committed to aragilar/pytest-info-collector by bors[bot] 3 years ago
- Merge #6 #7 6: Pin pytest to latest version 6.2.3 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.3**. <details> <summary>Changelog</su... — committed to aragilar/spaceplot by bors[bot] 3 years ago
- Merge #6 6: Pin pytest to latest version 6.2.3 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.3**. <details> <summary>Changelog</summa... — committed to aragilar/spaceplot by bors[bot] 3 years ago
- Merge #19 #20 19: Update sphinx_rtd_theme to 0.5.2 r=aragilar a=pyup-bot This PR updates [sphinx_rtd_theme](https://pypi.org/project/sphinx_rtd_theme) from **0.5.0** to **0.5.2**. *The bot wasn'... — committed to aragilar/pytest-info-collector by bors[bot] 3 years ago
- Merge #20 20: Update pytest to 6.2.4 r=aragilar a=pyup-bot This PR updates [pytest](https://pypi.org/project/pytest) from **6.1.1** to **6.2.4**. <details> <summary>Changelog</summary> ... — committed to aragilar/pytest-info-collector by bors[bot] 3 years ago
- Merge #20 #23 20: Update pytest to 6.2.4 r=aragilar a=pyup-bot This PR updates [pytest](https://pypi.org/project/pytest) from **6.1.1** to **6.2.4**. <details> <summary>Changelog</summary> ... — committed to aragilar/pytest-info-collector by bors[bot] 3 years ago
- Merge #3 #4 3: Pin sphinx_rtd_theme to latest version 0.5.1 r=aragilar a=pyup-bot This PR pins [sphinx_rtd_theme](https://pypi.org/project/sphinx_rtd_theme) to the latest release **0.5.1**. *The... — committed to aragilar/spaceplot by bors[bot] 3 years ago
- Merge #7 #8 7: Pin sphinx_rtd_theme to latest version 0.5.2 r=aragilar a=pyup-bot This PR pins [sphinx_rtd_theme](https://pypi.org/project/sphinx_rtd_theme) to the latest release **0.5.2**. *The... — committed to aragilar/spaceplot by bors[bot] 3 years ago
- Merge #4 4: Pin pytest to latest version 6.2.2 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.2**. <details> <summary>Changelog</summa... — committed to aragilar/spaceplot by bors[bot] 3 years ago
- Merge #18 #20 18: Pin pytest to latest version 6.2.4 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.4**. <details> <summary>Changelog<... — committed to aragilar/spaceplot by bors[bot] 3 years ago
- Merge #16 16: Pin pytest to latest version 6.2.4 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.4**. <details> <summary>Changelog</sum... — committed to aragilar/venv_tools by bors[bot] 3 years ago
- chore(deps): update dependency pytest to v7 (#3) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [pytest](https://docs.pytest.org/en/latest/) ([sourc... — committed to jaypikay/doxy by deleted user a year ago
Hmm I don’t actually know as it uses a new tool to me called devspace, not quite sure how the mounting works.
It copies the code into the container but there is some sort of magic sync going on I don’t yet understand how it works.
That would be great, thanks!
I reinstalled everything, and deleted the
build
folder, and it’s now working. So I am using pytest 6.0.1, not the one from the branch, but still thePY_IGNORE_IMPORTMISMATCH=1
is set