-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #2527: Add ability to suppress nested venv courtesy notice #2581
Conversation
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 pypa#2527.
Hmmm, the tests were all passing when I ran them. I wonder what I've done wrong. |
tests/unit/test_core.py
Outdated
with redirect_stderr(f): | ||
warn_in_virtualenv() | ||
output = f.getvalue() | ||
assert 'Courtesy Notice' not in output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d recommend using capsys to redirect stdout/stderr here. I didn’t test myself, and cannot access Buildkite logs either, but suspect this caused the build failure on Python 2.
Can we just change the name of this to be a more generic ‘be less verbose’ variable? Maybe it should eventually toggle off all of the informational things we write to stderr |
Thanks for the prompt feedback! I'll switch to capsys - I feel kinda silly for not noticing it earlier. @techalchemy, how do we feel about PIPENV_CONCISE? Or maybe PIPENV_TERSE? I figure PIPENV_SHUT_UP is out of the question? |
Could we make this more generic, like, combining it with the |
PIPENV_VERBOSITY as an integer value sounds good to me! I'm assuming 0 will be the default (most verbose) setting, and we can assess higher values as needed later? |
Changed PIPENV_SUPPRESS_NESTED_WARNING to PIPENV_VERBOSITY, an integer value that defaults to 0 (verbose). Changed test in test_core.py to use capsys to capture standard output/error in order to improve compatibility with Python 2.
This will add an environment variable, PIPENV_SUPPRESS_NESTED_WARNING, to be used to suppress the courtesy notice from warn_in_virtualenv (produced when pipenv finds itself running inside another virtual environment).
It will also add a sentence to the end of the courtesy notice to tell users how to suppress the notice.
I ended up putting the test in its own file - if there's a more logical place to put it, let me know!
Fixes #2527.