Skip to content

Commit 6ab490b

Browse files
committed
Make sure that patching is correctly stopped
- add more hooks to ensure pause/resume for module and session scoped fs fixtures
1 parent 6d0d3c6 commit 6ab490b

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

.github/workflows/testsuite.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ jobs:
115115
os: [ubuntu-latest, macOS-latest, windows-latest]
116116
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13"]
117117
pytest-version: [6.2.5, 7.0.1, 7.4.4, 8.0.2, 8.3.4]
118-
exclude:
119-
# some tests still fail for macOS/Python 3.13
120-
- python-version: "3.13"
121-
os: macOS-latest
122118
steps:
123119
- uses: actions/checkout@v4
124120
- name: Set up Python ${{ matrix.python-version }}

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ The released versions correspond to PyPI releases.
1212
* the default for `FakeFilesystem.shuffle_listdir_results` will change to `True` to reflect
1313
the real filesystem behavior
1414

15+
## Unreleased
16+
17+
### Fixes
18+
* fixed a problem with module and session scoped fixtures in Python 3.13
19+
(see [#1101](../../issues/1101))
20+
1521
## [Version 5.7.3](https://pypi.python.org/pypi/pyfakefs/5.7.3) (2024-12-15)
1622
Fixes a regression in version 5.7.3.
1723

pyfakefs/pytest_plugin.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,18 @@ def pytest_runtest_logreport(report):
8989
if pause:
9090
Patcher.PATCHER.pause()
9191
yield
92-
if pause:
92+
93+
94+
@pytest.hookimpl(hookwrapper=True, trylast=True)
95+
def pytest_runtest_call(item):
96+
if Patcher.PATCHER is not None:
9397
Patcher.PATCHER.resume()
98+
yield
99+
100+
101+
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
102+
def pytest_runtest_teardown(item, nextitem):
103+
"""Make sure that patching is not active during reporting."""
104+
if Patcher.PATCHER is not None:
105+
Patcher.PATCHER.pause()
106+
yield

0 commit comments

Comments
 (0)