Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

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

Tim Abbottdbf3894c499d
diff --git a/docs/testing/testing-with-django.md b/docs/testing/testing-with-django.md
index e7547066268..2b26d732a78 100644
--- a/docs/testing/testing-with-django.md
+++ b/docs/testing/testing-with-django.md
@@ -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
diff --git a/tools/ci/backend b/tools/ci/backend
index 3f6278ae2a7..90327300a66 100755
--- a/tools/ci/backend
+++ b/tools/ci/backend
@@ -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.
diff --git a/tools/test-all b/tools/test-all
index e897083d466..2421a98baaa 100755
--- a/tools/test-all
+++ b/tools/test-all
@@ -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