Skip to content

pytest > 3.8.x doesn't found tests if given test file is symbolic link #4325

@calmjm

Description

@calmjm

Trying to run pytest > 3.8.x in Linux (Ubuntu 18.04 / Fedora 28) with tests behind symbolic link fails to ERROR: not found.

$ cat test.py 
import pytest

class Test:
    def test_foo(self):
        assert 1 == 1
$ ln -s test.py linked-test.py
$ pytest -vs test.py 
============================================================================ test session starts ============================================================================
platform linux -- Python 3.6.6, pytest-3.10.0, py-1.7.0, pluggy-0.8.0 -- /home/janmaa01/pyte/bin/python3
cachedir: .pytest_cache
rootdir: /home/janmaa01/pytest-bug, inifile:
collected 1 item                                                                                                                                                            

test.py::Test::test_foo PASSED

========================================================================= 1 passed in 0.02 seconds ==========================================================================

$ pytest -vs linked-test.py 
============================================================================ test session starts ============================================================================
platform linux -- Python 3.6.6, pytest-3.10.0, py-1.7.0, pluggy-0.8.0 -- /home/janmaa01/pyte/bin/python3
cachedir: .pytest_cache
rootdir: /home/janmaa01/pytest-bug, inifile:
collecting ... 
======================================================================= no tests ran in 0.00 seconds ========================================================================
ERROR: not found: /home/janmaa01/pytest-bug/linked-test.py
(no name '/home/janmaa01/pytest-bug/linked-test.py' in any of [])

$ pip list
atomicwrites (1.2.1)
attrs (18.2.0)
more-itertools (4.3.0)
pip (9.0.3)
pluggy (0.8.0)
py (1.7.0)
pytest (3.10.0)
setuptools (39.2.0)
six (1.11.0)

Metadata

Metadata

Assignees

Labels

topic: collectionrelated to the collection phasetype: bugproblem that needs to be addressed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions