Skip to content

Commit

Permalink
Show new test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
lesteve committed Jan 9, 2024
1 parent e582ba0 commit 31a4291
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,8 @@ def _importconftest(
) -> types.ModuleType:
# 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)
# normalized_conftestpath = os.path.normcase(conftestpath)
existing = self.get_plugin(str(conftestpath))
if existing is not None:
return cast(types.ModuleType, existing)

Expand Down Expand Up @@ -747,8 +747,8 @@ def consider_conftest(self, conftestmodule: types.ModuleType) -> None:
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)
# normalized_name = name if name is None else os.path.normcase(name)
self.register(conftestmodule, name=name)

def consider_env(self) -> None:
""":meta private:"""
Expand Down
18 changes: 10 additions & 8 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1416,27 +1416,29 @@ def test_issue_9765(pytester: Pytester) -> None:

my_plugin_content = textwrap.dedent(
"""
def pytest_configure(config):
import pytest
def pytest_configure(config):
class SimplePlugin:
@pytest.fixture(params=[1, 2, 3])
def my_fixture(self, request):
yield request.param
class SimplePlugin:
@pytest.fixture(params=[1, 2, 3])
def my_fixture(self, request):
yield request.param
config.pluginmanager.register(SimplePlugin())
config.pluginmanager.register(SimplePlugin())
"""
)
pytester.makepyfile(
**{
"setup.py": setup_py_content,
"pyproject.toml": pyproject_toml_content,
"my_package/__init__.py": "",
"my_package/conftest.py": "",
"my_package/test_foo.py": "def test(): pass",
"my_package/plugin/__init__.py": "",
"mypackage/plugin/my_plugin.py": my_plugin_content,
"my_package/plugin/my_plugin.py": my_plugin_content,
}
)
pytester.makefile(**{"pyproject": pyproject_toml_content}, ext=".toml")

pytester.chdir()
subprocess.check_output([sys.executable, "setup.py", "develop"])
Expand Down
3 changes: 2 additions & 1 deletion testing/test_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ def test_setinitial_conftest_subdirs(pytester: Pytester, name: str) -> None:
subconftest.touch()
pm = PytestPluginManager()
conftest_setinitial(pm, [sub.parent], confcutdir=pytester.path)
key = os.path.normcase(subconftest.resolve())
# key = os.path.normcase(subconftest.resolve())
key = str(subconftest.resolve())
if name not in ("whatever", ".dotdir"):
assert pm.has_plugin(key)
assert len(set(pm.get_plugins()) - {pm}) == 1
Expand Down

0 comments on commit 31a4291

Please sign in to comment.