def test_does_not_crash_on_recursive_symlink(pytester: Pytester) -> None:
    """Regression test for an issue around recursive symlinks (#7951)."""
    symlink_or_skip("recursive", pytester.path.joinpath("recursive"))
    pytester.makepyfile(
        """
        def test_foo(): assert True
        """
    )
    result = pytester.runpytest()

    assert result.ret == ExitCode.OK
    assert result.parseoutcomes() == {"passed": 1}
Regression test for an issue around recursive symlinks (#7951).
testing/test_collection.py