Skip to content

Commit 936a40e

Browse files
committed
fix(exceptions): tests now capture critical only and uncaught exceptions have been reclassified as critical
1 parent ede58f1 commit 936a40e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

rootfs/api/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def custom_exception_handler(exc, context):
3131
# No response means DRF couldn't handle it
3232
# Output a generic 500 in a JSON format
3333
if response is None:
34-
logging.exception('Uncaught Exception', exc_info=exc)
34+
logging.exception('Uncaught Exception', exc_info=exc, level=logging.CRITICAL)
3535
set_rollback()
3636
return Response({'detail': 'Server Error'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
3737

rootfs/api/tests/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class SilentDjangoTestSuiteRunner(DiscoverRunner):
4545

4646
def run_tests(self, test_labels, extra_tests=None, **kwargs):
4747
"""Run tests with all but critical log messages disabled."""
48-
# hide any log messages less than error (critical and error are shown)
49-
logging.disable(logging.WARNING)
48+
# hide any log messages less than critical
49+
logging.disable(logging.ERROR)
5050
return super(SilentDjangoTestSuiteRunner, self).run_tests(
5151
test_labels, extra_tests, **kwargs)

0 commit comments

Comments
 (0)