Skip to content

Commit

Permalink
Reduce build log verbosity on Travis (#6597)
Browse files Browse the repository at this point in the history
PR #6568 removed the --quiet option in pip invocations, because this option deletes a lot of extremely useful logs when something goes wrong. However, when everything goes right, or at least when pip install is correctly executed, theses logs add hundreds of lines that are only noise, making hard to debug errors that can be in only one or two lines.

We can have best of both worlds. Travis allows to fold large blocks of logs, that can be expanded directly from the UI if needed. It only requires to print in the console some specific code, that this PR implements in the pip_install.py script when the build is run in Travis (known by the existence of TRAVIS environment variable).

I also take the occasion to clean up a little tox.ini.

Note that AppVeyor does not have this fold capability, but it can be emulated using a proper capture of stdout/stderr delivered only when an error is detected.

* Fold pip install log on travis

* Global test env

* Export env variable
  • Loading branch information
adferrand authored and bmw committed Jan 9, 2019
1 parent 5130e9b commit b52cbc0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ before_install:

before_script:
- 'if [ $TRAVIS_OS_NAME = osx ] ; then ulimit -n 1024 ; fi'
- export TOX_TESTENV_PASSENV=TRAVIS

matrix:
include:
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ install:
build: off

test_script:
- set TOX_TESTENV_PASSENV=APPVEYOR
# Test env is set by TOXENV env variable
- tox

Expand Down
7 changes: 7 additions & 0 deletions tools/pip_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ def main(args):
tools_path = find_tools_path()
working_dir = tempfile.mkdtemp()

if os.environ.get('TRAVIS'):
# When this script is executed on Travis, the following print will make the log
# be folded until the end command is printed (see finally section).
print('travis_fold:start:install_certbot_deps')

try:
test_constraints = os.path.join(working_dir, 'test_constraints.txt')
all_constraints = os.path.join(working_dir, 'all_constraints.txt')
Expand All @@ -89,6 +94,8 @@ def main(args):
call_with_print('"{0}" -m pip install --constraint "{1}" {2}'
.format(sys.executable, all_constraints, ' '.join(args)))
finally:
if os.environ.get('TRAVIS'):
print('travis_fold:end:install_certbot_deps')
shutil.rmtree(working_dir)


Expand Down
7 changes: 0 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ source_paths =
tests/lock_test.py

[testenv]
passenv =
TRAVIS
APPVEYOR
commands =
{[base]install_and_test} {[base]all_packages}
python tests/lock_test.py
Expand Down Expand Up @@ -176,7 +173,6 @@ whitelist_externals =
docker
passenv =
DOCKER_*
TRAVIS

[testenv:nginx_compat]
commands =
Expand All @@ -187,7 +183,6 @@ whitelist_externals =
docker
passenv =
DOCKER_*
TRAVIS

[testenv:le_auto_precise]
# At the moment, this tests under Python 2.7 only, as only that version is
Expand All @@ -199,7 +194,6 @@ whitelist_externals =
docker
passenv =
DOCKER_*
TRAVIS

[testenv:le_auto_trusty]
# At the moment, this tests under Python 2.7 only, as only that version is
Expand All @@ -212,7 +206,6 @@ whitelist_externals =
docker
passenv =
DOCKER_*
TRAVIS
TRAVIS_BRANCH

[testenv:le_auto_wheezy]
Expand Down

0 comments on commit b52cbc0

Please sign in to comment.