Skip to content

Commit b8d1d4d

Browse files
author
Joachim Jablon
authored
Merge pull request #92 from peopledoc/isolate-tests
Isolate tests from env vars
2 parents 79835de + 4012b38 commit b8d1d4d

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

tests/conftest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import os
2+
3+
import pytest
4+
5+
from vault_cli import settings
6+
7+
8+
@pytest.fixture(autouse=True)
9+
def isolate_tests():
10+
11+
for key in os.environ:
12+
if key.startswith(settings.ENV_PREFIX):
13+
os.environ.pop(key)

tests/integration/test_integration.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,9 @@ def test_integration_lib(clean_vault):
101101
assert client.lookup_token()["data"]
102102

103103

104-
@pytest.fixture
105-
def environ():
106-
yield os.environ
107-
os.environ.pop("VAULT_CLI_TOKEN")
108-
109-
110-
def test_env_var_config(environ):
104+
def test_env_var_config():
111105
# Test env var config
112-
environ["VAULT_CLI_TOKEN"] = "some-other-token"
106+
os.environ["VAULT_CLI_TOKEN"] = "some-other-token"
113107
with pytest.raises(vault_cli.VaultAPIException):
114108
vault_cli.get_client().set_secret("a", "b")
115109

0 commit comments

Comments
 (0)