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

Function test_setenv_deleted_meanwhile

testing/test_monkeypatch.py:141–153  ·  view source on GitHub ↗
(before: bool)

Source from the content-addressed store, hash-verified

139
140@pytest.mark.parametrize("before", [True, False])
141def test_setenv_deleted_meanwhile(before: bool) -> None:
142 key = "qwpeoip123"
143 if before:
144 os.environ[key] = "world"
145 monkeypatch = MonkeyPatch()
146 monkeypatch.setenv(key, "hello")
147 del os.environ[key]
148 monkeypatch.undo()
149 if before:
150 assert os.environ[key] == "world"
151 del os.environ[key]
152 else:
153 assert key not in os.environ
154
155
156def test_delitem() -> None:

Callers

nothing calls this directly

Calls 3

setenvMethod · 0.95
undoMethod · 0.95
MonkeyPatchClass · 0.90

Tested by

no test coverage detected