MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_cwd_snapshot

Function test_cwd_snapshot

testing/test_pytester.py:304–312  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

302
303
304def test_cwd_snapshot(pytester: Pytester) -> None:
305 foo = pytester.mkdir("foo")
306 bar = pytester.mkdir("bar")
307 os.chdir(foo)
308 snapshot = CwdSnapshot()
309 os.chdir(bar)
310 assert Path().absolute() == bar
311 snapshot.restore()
312 assert Path().absolute() == foo
313
314
315class TestSysModulesSnapshot:

Callers

nothing calls this directly

Calls 4

restoreMethod · 0.95
CwdSnapshotClass · 0.90
mkdirMethod · 0.45
chdirMethod · 0.45

Tested by

no test coverage detected