Skip to content

Commit

Permalink
test: isolate environment from user config
Browse files Browse the repository at this point in the history
  • Loading branch information
branchvincent authored Apr 27, 2022
1 parent 1abf363 commit 1b77dcf
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,21 @@ def environ() -> Iterator[None]:
os.environ.update(original_environ)


@pytest.fixture(autouse=True)
def isolate_environ() -> Iterator[None]:
"""Ensure the environment is isolated from user configuration."""
original_environ = dict(os.environ)

for var in os.environ:
if var.startswith("POETRY_"):
del os.environ[var]

yield

os.environ.clear()
os.environ.update(original_environ)


@pytest.fixture(autouse=True)
def git_mock(mocker: MockerFixture) -> None:
# Patch git module to not actually clone projects
Expand Down

0 comments on commit 1b77dcf

Please sign in to comment.