I am trying to use Docker to run our test cases.
I am sharing the git repo volume between host and guest.
I am also using pytest inside of tox.
When running pytext (from tox) in the Docker guest (ubuntu):
ImportError while loading conftest '/folder/python/tests/testcatalog/conftest.py'.
EINVAL: [Invalid argument]: samefile('/folder/python/tests/testcatalog/conftest.py', '/folder/python/tests/C:\\repos\\sdk\\python\\tests\\testcatalog\\conftest.py')
It seems the conftest.py is identifying both host and guest conftest.py files. In my opinion, it should only search for the guest.
Workaround:
If I copy the git folder into a new location in the Docker guest, it works fine.
The dependency list for tox:
deps =
pytest
pytest-html
pytest-timeout
future
Docker:
Windows host --> Ubuntu guest
I also run outside tox, the issue remains.
pytest --version
This is pytest version 4.6.2, imported from /usr/local/lib/python2.7/site-packages/pytest.pyc
setuptools registered plugins:
pytest-html-1.20.0 at /usr/local/lib/python2.7/site-packages/pytest_html/plugin.py
pytest-metadata-1.8.0 at /usr/local/lib/python2.7/site-packages/pytest_metadata/plugin.py
pytest-timeout-1.3.3 at /usr/local/lib/python2.7/site-packages/pytest_timeout.py
pytest-calvin-0.1.0 at /usr/local/lib/python2.7/site-packages/pytest_calvin-0.1.0-py2.7.egg/pytest_calvin/plugin.pyc
pytest-mock-1.10.4 at /usr/local/lib/python2.7/site-packages/pytest_mock-1.10.4-py2.7.egg/pytest_mock.py
pip list
when running pytest mounted across filesystems you'll need to clear .pyc files upon switching
Thanks guys that was my issue!
Most helpful comment
when running pytest mounted across filesystems you'll need to clear
.pycfiles upon switching