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

Method test_preserve_container

testing/test_pytester.py:409–421  ·  view source on GitHub ↗
(self, monkeypatch: MonkeyPatch, path_type)

Source from the content-addressed store, hash-verified

407 assert getattr(sys, other_path_type) == original_other
408
409 def test_preserve_container(self, monkeypatch: MonkeyPatch, path_type) -> None:
410 other_path_type = self.other_path[path_type]
411 original_data = list(getattr(sys, path_type))
412 original_other = getattr(sys, other_path_type)
413 original_other_data = list(original_other)
414 new: List[object] = []
415 snapshot = SysPathsSnapshot()
416 monkeypatch.setattr(sys, path_type, new)
417 snapshot.restore()
418 assert getattr(sys, path_type) is new
419 assert getattr(sys, path_type) == original_data
420 assert getattr(sys, other_path_type) is original_other
421 assert getattr(sys, other_path_type) == original_other_data
422
423
424def test_pytester_subprocess(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

restoreMethod · 0.95
SysPathsSnapshotClass · 0.90
setattrMethod · 0.80

Tested by

no test coverage detected