Skip to content

Commit bf230a7

Browse files
committed
Added a test suite switch to optionally show logging output. Normally this is suppressed while running tests. In production, it goes to syslog's user facility. With --show-logging, it will go to the console when running tests.
- Legacy-Id: 18010
1 parent a6a99a4 commit bf230a7

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

ietf/utils/log.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ def _flushfunc():
6262
pass
6363
_logfunc = logfunc
6464
if settings.SERVER_MODE == 'test':
65-
## Comment in when debugging for instance test smtp server failures:
66-
# if e:
67-
# _logfunc = debug.say
68-
# _flushfunc = sys.stdout.flush # pyflakes:ignore (intentional redefinition)
69-
# else:
65+
if settings.show_logging:
66+
_logfunc = debug.say
67+
_flushfunc = sys.stdout.flush # pyflakes:ignore (intentional redefinition)
68+
else:
7069
return
7170
elif settings.DEBUG == True:
7271
_logfunc = debug.say

ietf/utils/test_runner.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,13 +516,18 @@ def add_arguments(cls, parser):
516516
parser.add_argument('--permit-mixed-migrations',
517517
action='store_true', default=False,
518518
help='Permit interleaved unreleased migrations')
519+
parser.add_argument('--show-logging',
520+
action='store_true', default=False,
521+
help='Show logging output going to LOG_USER in production mode')
519522

520-
def __init__(self, skip_coverage=False, save_version_coverage=None, html_report=None, permit_mixed_migrations=None, **kwargs):
523+
def __init__(self, skip_coverage=False, save_version_coverage=None, html_report=None, permit_mixed_migrations=None, show_logging=None, **kwargs):
521524
#
522525
self.check_coverage = not skip_coverage
523526
self.save_version_coverage = save_version_coverage
524527
self.html_report = html_report
525528
self.permit_mixed_migrations = permit_mixed_migrations
529+
self.show_logging = show_logging
530+
settings.show_logging = show_logging
526531
#
527532
self.root_dir = os.path.dirname(settings.BASE_DIR)
528533
self.coverage_file = os.path.join(self.root_dir, settings.TEST_COVERAGE_MASTER_FILE)

0 commit comments

Comments
 (0)