Tweak comment

This commit is contained in:
Bruno Oliveira 2024-03-03 09:06:26 -03:00
parent bb48b7529a
commit 0ac1c3750d
1 changed files with 6 additions and 5 deletions

View File

@ -925,11 +925,12 @@ class Session(nodes.Collector):
# In case the file paths do not match, fallback to samefile() to
# account for short-paths on Windows (#11895).
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])
# We don't want to match links to the current node,
# otherwise we would match the same file more than once (#12039).
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: