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

Method delenv

src/_pytest/monkeypatch.py:304–311  ·  view source on GitHub ↗

Delete ``name`` from the environment. Raises ``KeyError`` if it does not exist, unless ``raising`` is set to False.

(self, name: str, raising: bool = True)

Source from the content-addressed store, hash-verified

302 self.setitem(os.environ, name, value)
303
304 def delenv(self, name: str, raising: bool = True) -> None:
305 """Delete ``name`` from the environment.
306
307 Raises ``KeyError`` if it does not exist, unless ``raising`` is set to
308 False.
309 """
310 environ: MutableMapping[str, str] = os.environ
311 self.delitem(environ, name, raising=raising)
312
313 def syspath_prepend(self, path) -> None:
314 """Prepend ``path`` to ``sys.path`` list of import locations."""

Callers 15

__init__Method · 0.95
test_delenvFunction · 0.95
test_xdist_normalMethod · 0.80
test_xdist_verboseMethod · 0.80
test_xdist_normalMethod · 0.80
test_cache_reportheaderFunction · 0.80

Calls 1

delitemMethod · 0.95

Tested by 15

__init__Method · 0.76
test_delenvFunction · 0.76
test_xdist_normalMethod · 0.64
test_xdist_verboseMethod · 0.64
test_xdist_normalMethod · 0.64
test_cache_reportheaderFunction · 0.64