From 125dcad379749973837df5dd23f33fc30bd2d95e Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 18 Aug 2016 08:10:15 -0700 Subject: [PATCH] tools: Report OverflowErrors in url coverage report. --- zerver/lib/test_helpers.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/zerver/lib/test_helpers.py b/zerver/lib/test_helpers.py index 62116d8b1b..c59490e60d 100644 --- a/zerver/lib/test_helpers.py +++ b/zerver/lib/test_helpers.py @@ -233,8 +233,18 @@ def write_instrumentation_reports(): fn = os.path.join(var_dir, 'url_coverage.txt') with open(fn, 'w') as f: for call in calls: - line = ujson.dumps(call) - f.write(line + '\n') + try: + line = ujson.dumps(call) + f.write(line + '\n') + except OverflowError: + print(''' + A JSON overflow error was encountered while + producing the URL coverage report. Sometimes + this indicates that a test is passing objects + into methods like client_post(), which is + unnecessary and leads to false positives. + ''') + print(call) print('URL coverage report is in %s' % (fn,)) print('Try running: ./tools/analyze-url-coverage')