✏️ 正在编辑: test_fs_with_monkeypatch.py
路径:
/opt/cloudlinux/venv/lib/python3.11/site-packages/pyfakefs/pytest_tests/test_fs_with_monkeypatch.py
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
from pyfakefs.fake_filesystem import FakeFileOpen def test_monkeypatch_with_fs(fs, monkeypatch): """Regression test for issue 1200""" fake_open = FakeFileOpen(fs) monkeypatch.setattr("builtins.open", fake_open, raising=False) def test_open(): """Tests if open is poisoned by the above test""" assert "built-in" in str(open)
💾 保存文件
← 返回文件管理器