diff --git a/changelog/12039.bugfix.rst b/changelog/12039.bugfix.rst index 038d9b755..1ff40b177 100644 --- a/changelog/12039.bugfix.rst +++ b/changelog/12039.bugfix.rst @@ -1 +1 @@ -Fixed a regression in 8.0.2 where tests have been collected multiple times in the CI under Windows \ No newline at end of file +Fixed a regression in 8.0.2 where tests have been collected multiple times in the CI under Windows diff --git a/src/_pytest/main.py b/src/_pytest/main.py index 67d6e142a..a6e860bb6 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -927,10 +927,9 @@ class Session(nodes.Collector): same_file = os.path.samefile(node.path, matchparts[0]) # we don't want to find links, so we at least # exclude symlinks to regular directories - is_match = ( - same_file and - os.path.islink(node.path) == os.path.islink(matchparts[0]) - ) + is_match = same_file and os.path.islink( + node.path + ) == os.path.islink(matchparts[0]) # Name part e.g. `TestIt` in `/a/b/test_file.py::TestIt::test_it`. else: