Make install --quiet really quiet

Commit 5bb989993 added some code for hiding/showing the cursor when
running on the terminal, but accidentally made it so that it always
printed the invisible control codes, even when not on a tty or when
--quiet was specified. This turns out to be surprisingly bad (e.g. it
breaks the official docker python builds). So, let's not do that.

Fixes gh-3418
This commit is contained in:
Nathaniel J. Smith 2016-02-01 12:36:49 -08:00
parent 66aef8e21f
commit af675e7797
3 changed files with 21 additions and 0 deletions

View File

@ -1,5 +1,7 @@
**8.1.0 (unreleased)**
* Make ``install --quiet`` really quiet. See #3418.
**8.0.2 (2016-01-21)**

View File

@ -219,6 +219,11 @@ def hidden_cursor(file):
# even via colorama. So don't even try.
if WINDOWS:
yield
# We don't want to clutter the output with control characters if we're
# writing to a file, or if the user is running with --quiet.
# See https://github.com/pypa/pip/issues/3418
elif not file.isatty() or logger.getEffectiveLevel() > logging.INFO:
yield
else:
file.write(HIDE_CURSOR)
try:

View File

@ -235,6 +235,20 @@ def test_install_from_local_directory(script, data):
assert egg_info_folder in result.files_created, str(result)
def test_install_quiet(script, data):
"""
Test that install -q is actually quiet.
"""
# Apparently if pip install -q is not actually quiet, then it breaks
# everything. See:
# https://github.com/pypa/pip/issues/3418
# https://github.com/docker-library/python/issues/83
to_install = data.packages.join("FSPkg")
result = script.pip('install', '-q', to_install, expect_error=False)
assert result.stdout == ""
assert result.stderr == ""
def test_hashed_install_success(script, data, tmpdir):
"""
Test that installing various sorts of requirements with correct hashes