Files
pipenv/tests/unit/test_core.py
T
Haplo 7c681cc139 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.
2018-07-25 15:24:54 +08:00

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