Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that patching is correctly stopped #1106

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
15 changes: 14 additions & 1 deletion pyfakefs/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading