File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -935,13 +935,11 @@ def collect(self) -> Iterator[nodes.Item | nodes.Collector]:
935
935
is_match = node .path == matchparts [0 ]
936
936
if sys .platform == "win32" and not is_match :
937
937
# In case the file paths do not match, fallback to samefile() to
938
- # account for short-paths on Windows (#11895).
939
- same_file = os .path .samefile (node .path , matchparts [0 ])
940
- # We don't want to match links to the current node,
941
- # otherwise we would match the same file more than once (#12039).
942
- is_match = same_file and (
943
- os .path .islink (node .path )
944
- == os .path .islink (matchparts [0 ])
938
+ # account for short-paths on Windows (#11895). But use a version
939
+ # which doesn't resolve symlinks, otherwise we might match the
940
+ # same file more than once (#12039).
941
+ is_match = os .path .samestat (
942
+ node .path .lstat (), matchparts [0 ].lstat ()
945
943
)
946
944
947
945
# Name part e.g. `TestIt` in `/a/b/test_file.py::TestIt::test_it`.
You can’t perform that action at this time.
0 commit comments