From eb60084ebe0ac06d11e2cdaad56b9bb0d8171a93 Mon Sep 17 00:00:00 2001 From: Sebastien Awwad Date: Tue, 19 Feb 2019 13:38:10 -0500 Subject: [PATCH] Reduce test spam by using unittest output buffering Thanks go to @lukpueh for this helpful tip. After merge, stdout should only appear if a test has failed. This functionality is provided by `unittest.TextTestRunner` argument `buffer=True`. This functions like the `--buffer` command line argument listed here: https://docs.python.org/3/library/unittest.html#command-line-options std out is discarded if a test succeeds. Signed-off-by: Sebastien Awwad --- tests/aggregate_tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/aggregate_tests.py b/tests/aggregate_tests.py index 2654bee6a8..d814737928 100755 --- a/tests/aggregate_tests.py +++ b/tests/aggregate_tests.py @@ -91,7 +91,8 @@ if __name__ == '__main__': suite = unittest.TestLoader().loadTestsFromNames(test_modules_to_run) - all_tests_passed = unittest.TextTestRunner(verbosity=1).run(suite).wasSuccessful() + all_tests_passed = unittest.TextTestRunner( + verbosity=1, buffer=True).run(suite).wasSuccessful() if not all_tests_passed: sys.exit(1)