-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
topic: collectionrelated to the collection phaserelated to the collection phasetype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
Since upgrading from pytest 3.8.2 to 3.9.3 (and 3.10.0), one of my tests are failing because the nodeid has an additional ::. It seems related to symlinks. Reproducer with two files:
# tests/conftest.py
def pytest_collection_modifyitems(items):
for item in items:
print(item.nodeid)
assert not item.nodeid.startswith('::')
#name = item.nodeid.split("::")[0].replace(".py", "").replace("/", ".")
# tests/test_some.py
def test_some():
passWorking:
$ pytest -v tests/
platform linux -- Python 3.7.1, pytest-3.10.0, py-1.7.0, pluggy-0.8.0 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /tmp/bla, inifile:
plugins: xdist-1.24.0, forked-0.2
collecting ... tests/test_some.py::test_some
collected 1 item
tests/test_some.py::test_some PASSED
Not working (I was not able to reproduce it with a symlink at /tmp/foo or /tmp/bla/foo):
$ ln -s $PWD/tests ~/foo
$ pytest -v ~/foo
latform linux -- Python 3.7.1, pytest-3.10.0, py-1.7.0, pluggy-0.8.0 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /home/peter/foo, inifile:
plugins: xdist-1.24.0, forked-0.2
collecting ... ::test_some.py::test_some
...
INTERNALERROR> AssertionError: assert not True
INTERNALERROR> + where True = <built-in method startswith of str object at 0x7fbf2d5a54e0>('::')
INTERNALERROR> + where <built-in method startswith of str object at 0x7fbf2d5a54e0> = '::test_some.py::test_some'.startswith
INTERNALERROR> + where '::test_some.py::test_some' = <Function 'test_some'>.nodeid
Possibly related issues:
#4174 (I also encountered this issue with 3.9.1 and 3.9.2, but not 3.9.3).
#4108
Metadata
Metadata
Assignees
Labels
topic: collectionrelated to the collection phaserelated to the collection phasetype: bugproblem that needs to be addressedproblem that needs to be addressed