test-backend: Enable --ban-console-output and document.

This commit is contained in:
Tim Abbott 2020-08-26 16:56:36 -07:00 committed by Tim Abbott
parent 3390a70bcd
commit dbf3894c49
3 changed files with 9 additions and 2 deletions

View File

@ -436,6 +436,13 @@ code and edge cases. It will generate a nice HTML report that you can
view right from your browser (the tool prints the URL where the report
is exposed in your development environment).
- **Console output** A properly written test should print nothing to
the console; use `with self.assertLogs` to capture and verify any
logging output. Note that we reconfigure various loggers in
`zproject/test_extra_settings.py` where the output is unlikely to be
interesting when running our test suite. `test-backend
--ban-console-output` checks for stray print statements.
Note that `test-backend --coverage` will assert that
various specific files in the project have 100% test coverage and
throw an error if their coverage has fallen. One of our project goals

View File

@ -12,7 +12,7 @@ set -x
# docker setup means the auto-detection logic sees the ~36 processes
# the Docker host has, not the ~2 processes of resources we're
# allocated.
./tools/test-backend --coverage --include-webhooks --no-cov-cleanup --parallel=6
./tools/test-backend --coverage --include-webhooks --no-cov-cleanup --ban-console-output --parallel=6
# We run mypy after the backend tests so we get output from the
# backend tests, which tend to uncover more serious problems, first.

View File

@ -49,7 +49,7 @@ run ./tools/clean-repo
# ci/backend
run ./tools/lint --groups=backend $FORCEARG
run ./tools/test-tools
run ./tools/test-backend --include-webhooks $FORCEARG
run ./tools/test-backend --include-webhooks --ban-console-output $FORCEARG
run ./tools/test-migrations
# Not running SVG optimizing since it's low-churn
# run ./tools/setup/optimize-svg