From 9f2668dc080834da95d0e3afc22cfbfafb45243b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 3 Mar 2024 07:42:33 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- changelog/12039.bugfix.rst | 2 +- src/_pytest/main.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) 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: