MCPcopy
hub / github.com/pytest-dev/pytest / test_preserve_container

Method test_preserve_container

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

Source from the content-addressed store, hash-verified

398 assert getattr(sys, other_path_type) == original_other
399
400 def test_preserve_container(self, monkeypatch: MonkeyPatch, path_type) -> None:
401 other_path_type = self.other_path[path_type]
402 original_data = list(getattr(sys, path_type))
403 original_other = getattr(sys, other_path_type)
404 original_other_data = list(original_other)
405 new: list[object] = []
406 snapshot = SysPathsSnapshot()
407 monkeypatch.setattr(sys, path_type, new)
408 snapshot.restore()
409 assert getattr(sys, path_type) is new
410 assert getattr(sys, path_type) == original_data
411 assert getattr(sys, other_path_type) is original_other
412 assert getattr(sys, other_path_type) == original_other_data
413
414
415def 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