diff --git a/CHANGES.md b/CHANGES.md index 5fee735c..bc7217a9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,6 +20,8 @@ The released versions correspond to PyPI releases. ### Fixes * fixes a problem with `Path` type hints using the pipe symbol in wrapped functions inside an `fs` dependent fixture (see [#1242](../../issues/1242)) +* fixes problem with new `coverage` in Python 3.14 using the fake filesystem + (see [#1245](../../issues/1245)) ## [Version 5.10.2](https://pypi.python.org/pypi/pyfakefs/5.10.2) (2025-11-04) Fixes a problem with `pathlib.glob` in Python 3.14. diff --git a/pyfakefs/fake_filesystem_unittest.py b/pyfakefs/fake_filesystem_unittest.py index 0fa6dac7..738c32a3 100644 --- a/pyfakefs/fake_filesystem_unittest.py +++ b/pyfakefs/fake_filesystem_unittest.py @@ -1012,7 +1012,12 @@ def _refresh(self) -> None: for name in self._fake_module_classes: self.fake_modules[name] = self._fake_module_classes[name](self.fs) if hasattr(self.fake_modules[name], "skip_names"): - self.fake_modules[name].skip_names = self.skip_names + self.fake_modules[name].skip_names = self.skip_names | { + # also skip non-build-in skipped modules + m.__name__ + for m in self.SKIPMODULES + if m and "." in m.__name__ + } self.fake_modules[PATH_MODULE] = self.fake_modules["os"].path for name in self._unfaked_module_classes: self.unfaked_modules[name] = self._unfaked_module_classes[name]() diff --git a/pyfakefs/pytest_plugin.py b/pyfakefs/pytest_plugin.py index 64a309a5..a4f56040 100644 --- a/pyfakefs/pytest_plugin.py +++ b/pyfakefs/pytest_plugin.py @@ -19,14 +19,21 @@ def my_fakefs_test(fs): try: from _pytest import pathlib + + Patcher.SKIPMODULES.add(pathlib) except ImportError: - pathlib = None # type:ignore[assignment] + pass + +try: + from coverage import python # type:ignore[import] + + Patcher.SKIPMODULES.add(python) +except ImportError: + pass Patcher.SKIPMODULES.add(py) Patcher.SKIPMODULES.add(pytest) Patcher.SKIPMODULES.add(capture) -if pathlib is not None: - Patcher.SKIPMODULES.add(pathlib) @pytest.fixture diff --git a/pyproject.toml b/pyproject.toml index cc3eea07..687938b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,6 +73,7 @@ xdist = [ [tool.setuptools] include-package-data = true +py-modules = ["pyfakefs"] [tool.setuptools.package-data] where = ["pyfakefs"]