added support for --no-logging argument to avoid leaking loggers in tests

This commit is contained in:
Lex Berezhny 2019-12-31 17:21:08 -05:00
parent 87c7ce588e
commit b49275fe6b
2 changed files with 7 additions and 2 deletions

View file

@ -187,6 +187,10 @@ def get_argument_parser():
'--quiet', dest='quiet', action="store_true",
help='Disable all console output.'
)
start.add_argument(
'--no-logging', dest='no_logging', action="store_true",
help='Disable all logging of any kind.'
)
start.add_argument(
'--verbose', nargs="*",
help=('Enable debug output for lbry logger and event loop. Optionally specify loggers for which debug output '
@ -261,6 +265,7 @@ def run_daemon(args: argparse.Namespace, conf: Config):
loop = asyncio.get_event_loop()
if args.verbose is not None:
loop.set_debug(True)
if not args.no_logging:
setup_logging(logging.getLogger(), args, conf)
daemon = Daemon(conf)

View file

@ -200,7 +200,7 @@ class CLITest(AsyncioTestCase):
raise KeyboardInterrupt
mock_daemon_start.side_effect = side_effect
self.shell(["start"])
self.shell(["start", "--no-logging"])
mock_daemon_start.assert_called_once()