Skip to content

Commit

Permalink
Manually apply pytest-dev#11708
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim authored Jan 9, 2024
1 parent ca856c3 commit 22949f2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,10 @@ def _rget_with_confmod(
def _importconftest(
self, conftestpath: Path, importmode: Union[str, ImportMode], rootpath: Path
) -> types.ModuleType:
existing = self.get_plugin(str(conftestpath))
# Avoid inconsistent path issues on Windows, see
# https://github.com/pytest-dev/pytest/issues/9765
normalized_conftestpath = os.path.normcase(conftestpath)
existing = self.get_plugin(normalized_conftestpath)
if existing is not None:
return cast(types.ModuleType, existing)

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

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

def consider_env(self) -> None:
""":meta private:"""
Expand Down

0 comments on commit 22949f2

Please sign in to comment.