Преглед на файлове

Print test trace files even when the suite fails

The CB_TEST_TRACE files were emitted by a command placed after pytest in
tox's commands list, and tox stops at the first failing command - so the
trace was printed only for passing runs, and a failing run, the one
whose trace is worth reading, lost it. Emit it from commands_post, which
tox runs regardless of the outcome; the environment still reports the
failure.
Nuwan Goonasekera преди 6 дни
родител
ревизия
936eed6ff5
променени са 1 файла, в които са добавени 5 реда и са изтрити 3 реда
  1. 5 3
      tox.ini

+ 5 - 3
tox.ini

@@ -16,14 +16,16 @@ commands = # see pyproject.toml for coverage options; setup.cfg for flake8
            # inferring it from gaps between result lines in the CI log, which
            # cannot separate a slow test from a worker waiting for work.
            coverage run --source=cloudbridge -m pytest -v --durations=25 {posargs:-n 5 tests/}
-           # Emit any CB_TEST_TRACE output (see tests/conftest.py). A no-op
-           # when tracing is off, which is the default.
-           python -c "import glob,sys;[sys.stdout.write(open(f).read()) for f in sorted(glob.glob('cb-trace-*.log'))]"
            # Combine parallel-mode data files and emit Cobertura XML for upload
            # by coverallsapp/github-action in CI. Locally this produces
            # coverage.xml in the project root, which IDEs can also consume.
            coverage combine
            coverage xml
+# Emit any CB_TEST_TRACE output (see tests/conftest.py). A no-op when tracing
+# is off, which is the default. This lives in commands_post rather than after
+# pytest in commands because tox stops at the first failing command, and a
+# failing run is the one whose trace is worth reading.
+commands_post = python -c "import glob,sys;[sys.stdout.write(open(f).read()) for f in sorted(glob.glob('cb-trace-*.log'))]"
 setenv =
     # Fix for moto import issue: https://github.com/travis-ci/travis-ci/issues/7940
     BOTO_CONFIG=/dev/null