Skip to content

Commit

Permalink
WIP: check if paths are the same in pathlib.import_path
Browse files Browse the repository at this point in the history
Related to pytest-dev#7678
  • Loading branch information
nicoddemus committed Sep 12, 2020
1 parent 634cde9 commit e3ad865
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/_pytest/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,9 @@ def import_path(
module_file = module_file[: -(len(os.path.sep + "__init__.py"))]

try:
is_same = os.path.samefile(str(path), module_file)
is_same = path == Path(module_file) or os.path.samefile(
str(path), module_file
)
except FileNotFoundError:
is_same = False

Expand Down

0 comments on commit e3ad865

Please sign in to comment.