mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
7c681cc139
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.
21 lines
574 B
Python
21 lines
574 B
Python
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
|