|
58 | 58 | from _pytest.pathlib import bestrelpath |
59 | 59 | from _pytest.pathlib import import_path |
60 | 60 | from _pytest.pathlib import ImportMode |
| 61 | +from _pytest.pathlib import module_realfile |
61 | 62 | from _pytest.pathlib import resolve_package_path |
62 | 63 | from _pytest.pathlib import safe_exists |
63 | 64 | from _pytest.stash import Stash |
@@ -631,8 +632,7 @@ def _rget_with_confmod( |
631 | 632 | def _importconftest( |
632 | 633 | self, conftestpath: Path, importmode: Union[str, ImportMode], rootpath: Path |
633 | 634 | ) -> types.ModuleType: |
634 | | - conftestpath_plugin_name = str(conftestpath) |
635 | | - existing = self.get_plugin(conftestpath_plugin_name) |
| 635 | + existing = self.get_plugin(str(conftestpath)) |
636 | 636 | if existing is not None: |
637 | 637 | return cast(types.ModuleType, existing) |
638 | 638 |
|
@@ -668,7 +668,7 @@ def _importconftest( |
668 | 668 | ) |
669 | 669 | mods.append(mod) |
670 | 670 | self.trace(f"loading conftestmodule {mod!r}") |
671 | | - self.consider_conftest(mod, registration_name=conftestpath_plugin_name) |
| 671 | + self.consider_conftest(mod) |
672 | 672 | return mod |
673 | 673 |
|
674 | 674 | def _check_non_top_pytest_plugins( |
@@ -748,11 +748,9 @@ def consider_pluginarg(self, arg: str) -> None: |
748 | 748 | del self._name2plugin["pytest_" + name] |
749 | 749 | self.import_plugin(arg, consider_entry_points=True) |
750 | 750 |
|
751 | | - def consider_conftest( |
752 | | - self, conftestmodule: types.ModuleType, registration_name: str |
753 | | - ) -> None: |
| 751 | + def consider_conftest(self, conftestmodule: types.ModuleType) -> None: |
754 | 752 | """:meta private:""" |
755 | | - self.register(conftestmodule, name=registration_name) |
| 753 | + self.register(conftestmodule, name=module_realfile(conftestmodule)) |
756 | 754 |
|
757 | 755 | def consider_env(self) -> None: |
758 | 756 | """:meta private:""" |
|
0 commit comments