Skip to content

Pytest crashes when recursive symlinks present #7951

@ghost

Description

When I have a test directory which contains a recursive symlink (in my case this is one of the assets we are checking that our software works in such case), pytest crashes with:

E   OSError: [Errno 40] Too many levels of symbolic links: '/tmp/tests/recursive'

The /tmp/tests directory looks like the following:

zsolt@localhost:/tmp$ ls -l /tmp/tests/
total 4
lrwxrwxrwx 1 zsolt zsolt  9 Oct 27 15:02 recursive -> recursive
-rw-rw-r-- 1 zsolt zsolt 36 Oct 27 15:01 test_dummy.py
zsolt@localhost:/tmp$ cat /tmp/tests/test_dummy.py 

def test_dummy():
    assert True

It used to work with pytest 6.0.2 and now it seems to be broken on 6.1.0 and above.

I'm running pytest with pytest /tmp/tests command from its own, clean venv having the given pytest version (6.0.2, 6.1.0 and 6.1.1) and its dependencies only.
I'm using Linux (Ubuntu bionic), but I think this happens on every system supporting recursive symlinks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: collectionrelated to the collection phasetype: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions