Skip to content

Commit

Permalink
Use temp_environ in test for CUSTOM_VENV_NAME
Browse files Browse the repository at this point in the history
This is so that PIPENV_CUSTOM_VENV_NAME does not leak to
other tests.
  • Loading branch information
oz123 committed Aug 4, 2022
1 parent ec38ae1 commit ca38db6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/integration/test_dot_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ def test_venv_name_accepts_custom_name_environment_variable(PipenvInstance):
"""
with PipenvInstance(chdir=True, venv_in_project=False) as p:
test_name = "sensible_custom_venv_name"
os.environ['PIPENV_CUSTOM_VENV_NAME'] = test_name
c = p.pipenv('install')
assert c.returncode == 0
c = p.pipenv('--venv')
assert c.returncode == 0
venv_path = c.stdout.strip()
assert test_name == Path(venv_path).parts[-1]
with temp_environ():
os.environ['PIPENV_CUSTOM_VENV_NAME'] = test_name
c = p.pipenv('install')
assert c.returncode == 0
c = p.pipenv('--venv')
assert c.returncode == 0
venv_path = c.stdout.strip()
assert test_name == Path(venv_path).parts[-1]

0 comments on commit ca38db6

Please sign in to comment.