diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index 0fbdec73..8c575e1f 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -115,10 +115,6 @@ jobs: os: [ubuntu-latest, macOS-latest, windows-latest] python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13"] pytest-version: [6.2.5, 7.0.1, 7.4.4, 8.0.2, 8.3.4] - exclude: - # some tests still fail for macOS/Python 3.13 - - python-version: "3.13" - os: macOS-latest steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} diff --git a/CHANGES.md b/CHANGES.md index 15ccb5b6..951d2e54 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,12 @@ The released versions correspond to PyPI releases. * the default for `FakeFilesystem.shuffle_listdir_results` will change to `True` to reflect the real filesystem behavior +## Unreleased + +### Fixes +* fixed a problem with module and session scoped fixtures in Python 3.13 + (see [#1101](../../issues/1101)) + ## [Version 5.7.3](https://pypi.python.org/pypi/pyfakefs/5.7.3) (2024-12-15) Fixes a regression in version 5.7.3. diff --git a/pyfakefs/pytest_plugin.py b/pyfakefs/pytest_plugin.py index 223ef2d4..16775000 100644 --- a/pyfakefs/pytest_plugin.py +++ b/pyfakefs/pytest_plugin.py @@ -89,5 +89,18 @@ def pytest_runtest_logreport(report): if pause: Patcher.PATCHER.pause() yield - if pause: + + +@pytest.hookimpl(hookwrapper=True, trylast=True) +def pytest_runtest_call(item): + if Patcher.PATCHER is not None: Patcher.PATCHER.resume() + yield + + +@pytest.hookimpl(hookwrapper=True, tryfirst=True) +def pytest_runtest_teardown(item, nextitem): + """Make sure that patching is not active during reporting.""" + if Patcher.PATCHER is not None: + Patcher.PATCHER.pause() + yield