aboutsummaryrefslogtreecommitdiff
path: root/pyfakefs/pytest_tests/pytest_module_fixture_test.py
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2023-08-29 22:31:30 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-08-29 22:31:30 +0000
commitee132a3ba2a7295008913e19af9328d0954f240e (patch)
treef40c1a21c47e1a74164c5feb8a577145a2970aeb /pyfakefs/pytest_tests/pytest_module_fixture_test.py
parentf9490653f18ce1f2997b79d6ef6d46f2b10ee44d (diff)
parentf1db2cd21ffd0089578fd72dd32e3df5f2f40f44 (diff)
downloadpyfakefs-ee132a3ba2a7295008913e19af9328d0954f240e.tar.gz
Upgrade pyfakefs to 979a878b12a3f625abe986a2249b677e6193ae3d am: a3bcabf4b7 am: 78fdc2ac9e am: 1261801ef1 am: 9f1f3798d8 am: f1db2cd21fHEADandroid-14.0.0_r51android-14.0.0_r50mastermainandroid14-qpr3-release
Original change: https://android-review.googlesource.com/c/platform/external/python/pyfakefs/+/2726660 Change-Id: I5d286395144c422ac19f4b0c0a1b5279f14942b7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'pyfakefs/pytest_tests/pytest_module_fixture_test.py')
-rw-r--r--pyfakefs/pytest_tests/pytest_module_fixture_test.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/pyfakefs/pytest_tests/pytest_module_fixture_test.py b/pyfakefs/pytest_tests/pytest_module_fixture_test.py
new file mode 100644
index 0000000..3140ec9
--- /dev/null
+++ b/pyfakefs/pytest_tests/pytest_module_fixture_test.py
@@ -0,0 +1,26 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import os
+
+import pytest
+
+
+@pytest.fixture(scope="module", autouse=True)
+def use_fs(fs_module):
+ fs_module.create_file(os.path.join("foo", "bar"))
+ yield fs_module
+
+
+@pytest.mark.usefixtures("fs")
+def test_fs_uses_fs_module():
+ # check that `fs` uses the same filesystem as `fs_module`
+ assert os.path.exists(os.path.join("foo", "bar"))