Add --report-slow-tests option to tools/test-backend.

This commit is contained in:
Steve Howell
2016-07-29 10:48:43 -07:00
committed by Tim Abbott
parent 29b04fe654
commit 4556bf528f
2 changed files with 35 additions and 1 deletions

View File

@@ -57,6 +57,10 @@ if __name__ == "__main__":
dest="generate_fixtures",
help=("Reduce running time by not calling generate-fixtures. "
"This may cause spurious failures for some tests."))
parser.add_option('--report-slow-tests', dest='report_slow_tests',
action="store_true",
default=False,
help="Show which tests are slowest.")
(options, args) = parser.parse_args()
if len(args) == 0:
@@ -111,6 +115,12 @@ if __name__ == "__main__":
print("Profile data saved to /tmp/profile.data")
print("You can visualize it using e.g. `runsnake /tmp/profile.data`")
if options.report_slow_tests:
from zerver.lib.test_runner import report_slow_tests
# We do this even with failures, since slowness can be
# an important clue as to why tests fail.
report_slow_tests()
if failures:
print('FAILED!')
else: