From cd82cdba632ab18d34acf65b75f3e34c978288bf Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Wed, 25 Jul 2018 15:28:55 +0800 Subject: [PATCH] Invert the verbosity flag (lower is less verbose) --- pipenv/core.py | 4 ++-- pipenv/environments.py | 7 ++++--- tests/unit/test_core.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pipenv/core.py b/pipenv/core.py index f8006eac..25bd0b7e 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1622,7 +1622,7 @@ def warn_in_virtualenv(): pipenv_active = os.environ.get("PIPENV_ACTIVE") if ( (PIPENV_USE_SYSTEM or PIPENV_VIRTUALENV) - and not (pipenv_active or PIPENV_VERBOSITY > 0) + and not (pipenv_active or PIPENV_VERBOSITY < 0) ): click.echo( "{0}: Pipenv found itself running within a virtual environment, " @@ -1633,7 +1633,7 @@ def warn_in_virtualenv(): "warning.".format( crayons.green("Courtesy Notice"), crayons.normal("PIPENV_IGNORE_VIRTUALENVS=1", bold=True), - crayons.normal("PIPENV_VERBOSITY=1", bold=True), + crayons.normal("PIPENV_VERBOSITY=-1", bold=True), ), err=True, ) diff --git a/pipenv/environments.py b/pipenv/environments.py index 32c5e1c5..afe82988 100644 --- a/pipenv/environments.py +++ b/pipenv/environments.py @@ -174,10 +174,11 @@ PIPENV_VENV_IN_PROJECT = bool(os.environ.get("PIPENV_VENV_IN_PROJECT")) Default is to create new virtual environments in a global location. """ -PIPENV_VERBOSITY = int(os.environ.get("PIPENV_VERBOSITY", "0")) -"""Verbosity setting for pipenv. Higher values make pipenv less verbose. +PIPENV_VERBOSITY = int(os.environ.get("PIPENV_VERBOSITY", 0)) +"""Verbosity setting for pipenv. -Default is 0, for maximum verbosity. +Higher values make pipenv more verbose, lower values less so. Default is 0, +for normal verbosity. """ PIPENV_YES = bool(os.environ.get("PIPENV_YES")) diff --git a/tests/unit/test_core.py b/tests/unit/test_core.py index 7b19c085..e737a59e 100644 --- a/tests/unit/test_core.py +++ b/tests/unit/test_core.py @@ -5,7 +5,7 @@ from pipenv.core import warn_in_virtualenv @mock.patch('pipenv.environments.PIPENV_VIRTUALENV', 'totallyrealenv') -@mock.patch('pipenv.environments.PIPENV_VERBOSITY', 1) +@mock.patch('pipenv.environments.PIPENV_VERBOSITY', -1) @pytest.mark.core def test_suppress_nested_venv_warning(capsys): # Capture the stderr of warn_in_virtualenv to test for the presence of the