-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to suppress nested venv courtesy notice
Added an environment variable, PIPENV_SUPPRESS_NESTED_WARNING, to be used to suppress the courtesy notice from warn_in_virtualenv. Changed wording of the courtesy notice to mention suppression variable. Fixes #2527.
- Loading branch information
1 parent
350aede
commit 7c681cc
Showing
3 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import io | ||
|
||
import pytest | ||
import mock | ||
from contextlib import redirect_stderr | ||
|
||
from pipenv.core import warn_in_virtualenv | ||
|
||
|
||
@mock.patch('pipenv.environments.PIPENV_VIRTUALENV', 'totallyrealenv') | ||
@mock.patch('pipenv.environments.PIPENV_SUPPRESS_NESTED_WARNING', '1') | ||
@pytest.mark.core | ||
def test_suppress_nested_venv_warning(): | ||
f = io.StringIO() | ||
# Capture the stderr of warn_in_virtualenv to test for the presence of the | ||
# courtesy notice. | ||
with redirect_stderr(f): | ||
warn_in_virtualenv() | ||
output = f.getvalue() | ||
assert 'Courtesy Notice' not in output |