Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_clean_pip_env(monkeypatch):
before_env_var = "test"
monkeypatch.setenv(PIP_REQUIRE_VIRTUALENV, before_env_var)
with clean_pip_env():
assert PIP_REQUIRE_VIRTUALENV not in os.environ
assert os.environ.get(PIP_REQUIRE_VIRTUALENV) == before_env_var
def test_clean_pip_env(monkeypatch):
before_env_var = "test"
monkeypatch.setenv(PIP_REQUIRE_VIRTUALENV, before_env_var)
with clean_pip_env():
assert PIP_REQUIRE_VIRTUALENV not in os.environ
assert os.environ.get(PIP_REQUIRE_VIRTUALENV) == before_env_var