Skip to content

Commit 22949f2

Browse files
authored
Manually apply pytest-dev#11708
1 parent ca856c3 commit 22949f2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/_pytest/config/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,10 @@ def _rget_with_confmod(
637637
def _importconftest(
638638
self, conftestpath: Path, importmode: Union[str, ImportMode], rootpath: Path
639639
) -> types.ModuleType:
640-
existing = self.get_plugin(str(conftestpath))
640+
# Avoid inconsistent path issues on Windows, see
641+
# https://github.com/pytest-dev/pytest/issues/9765
642+
normalized_conftestpath = os.path.normcase(conftestpath)
643+
existing = self.get_plugin(normalized_conftestpath)
641644
if existing is not None:
642645
return cast(types.ModuleType, existing)
643646

@@ -750,7 +753,11 @@ def consider_pluginarg(self, arg: str) -> None:
750753

751754
def consider_conftest(self, conftestmodule: types.ModuleType) -> None:
752755
""":meta private:"""
753-
self.register(conftestmodule, name=conftestmodule.__file__)
756+
name = conftestmodule.__file__
757+
# Avoid inconsistent path issues on Windows, see
758+
# https://github.com/pytest-dev/pytest/issues/9765
759+
normalized_name = name if name is None else os.path.normcase(name)
760+
self.register(conftestmodule, name=normalized_name)
754761

755762
def consider_env(self) -> None:
756763
""":meta private:"""

0 commit comments

Comments
 (0)