File tree Expand file tree Collapse file tree 5 files changed +66
-2
lines changed Expand file tree Collapse file tree 5 files changed +66
-2
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ jobs:
134
134
run : |
135
135
echo "$(python -m pytest pyfakefs/pytest_tests/pytest_plugin_failing_helper.py)" > ./testresult.txt
136
136
pytest pyfakefs/pytest_tests
137
+ pytest pyfakefs/pytest_session_tests
137
138
cd pyfakefs/pytest_tests/ns_package
138
139
pytest --log-cli-level=INFO test
139
140
shell : bash
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ The released versions correspond to PyPI releases.
25
25
* fixed a regression that could break tests under Posix in Python 3.12
26
26
(see [#1126](../../issues/1126))
27
27
* fixed behavior for `os.access` for symlinks under Windows
28
- * fixes permission problem on querying file properties (see [#1122](../../issues/1122))
28
+ * fixed permission problem on querying file properties (see [#1122](../../issues/1122))
29
+ * fixed patching in pytest setup phase for module and session-scoped fs fixtures
30
+ (see [#1126](../../issues/1126))
29
31
30
32
### Documentation
31
33
* use a theme for documentation supporting dark mode
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ def pytest_runtest_logreport(report):
92
92
93
93
94
94
@pytest .hookimpl (hookwrapper = True , trylast = True )
95
- def pytest_runtest_call (item ):
95
+ def pytest_runtest_setup (item ):
96
96
if Patcher .PATCHER is not None :
97
97
Patcher .PATCHER .resume ()
98
98
yield
Original file line number Diff line number Diff line change
1
+ from pathlib import Path
2
+
3
+ import pytest
4
+
5
+ from pyfakefs .fake_filesystem import FakeFilesystem
6
+
7
+
8
+ def pytest_generate_tests (metafunc ):
9
+ handlers = [a , b , c ]
10
+ if "handler_class" in metafunc .fixturenames :
11
+ metafunc .parametrize ("handler_class" , handlers )
12
+
13
+
14
+ def a ():
15
+ pass
16
+
17
+
18
+ def b ():
19
+ pass
20
+
21
+
22
+ def c ():
23
+ pass
24
+
25
+
26
+ @pytest .fixture
27
+ def class_a ():
28
+ pass
29
+
30
+
31
+ @pytest .fixture
32
+ def class_b ():
33
+ pass
34
+
35
+
36
+ @pytest .fixture
37
+ def class_c ():
38
+ pass
39
+
40
+
41
+ @pytest .fixture
42
+ def make_handler (request ):
43
+ def _make_handler (cls ):
44
+ return request .getfixturevalue (f"class_{ cls .__name__ } " )
45
+
46
+ yield _make_handler
47
+
48
+
49
+ @pytest .fixture
50
+ def handler_and_check (handler_class , make_handler ):
51
+ assert Path ("/foo/bar" ).exists ()
52
+ yield
53
+
54
+
55
+ def test_handler_and_check_in_fixture (handler_and_check ):
56
+ assert Path ("/foo/bar" ).exists ()
57
+
58
+
59
+ @pytest .fixture (scope = "session" , autouse = True )
60
+ def config (fs_session : FakeFilesystem ):
61
+ fs_session .create_file ("/foo/bar" )
You can’t perform that action at this time.
0 commit comments