From 5b8fd361c26515c10cd9afaf06d6db01c006f615 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Fri, 16 Aug 2013 15:53:43 +1200 Subject: [PATCH] Stop resetting logging on every call to __main__. __main__ is called directly during tests, but was resetting the logging environment within it, which prevented tests from capturing the log events. Change-Id: If710e11091723144c97c88aab4aa5e6126844d2b --- os_collect_config/collect.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/os_collect_config/collect.py b/os_collect_config/collect.py index 996c44a..944db80 100644 --- a/os_collect_config/collect.py +++ b/os_collect_config/collect.py @@ -135,8 +135,6 @@ def __main__(args=sys.argv, requests_impl_map=None): setup_conf() CONF(args=args[1:], prog="os-collect-config") - log.setup("os-collect-config") - unknown_collectors = set(CONF.collectors) - set(DEFAULT_COLLECTORS) if unknown_collectors: raise exc.InvalidArguments( @@ -179,4 +177,8 @@ def __main__(args=sys.argv, requests_impl_map=None): if __name__ == '__main__': + # This resets the logging infrastructure which prevents capturing log + # output in tests cleanly, so do it only if we're running as an actual + # process. + log.setup("os-collect-config") __main__()