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
This commit is contained in:
Robert Collins 2013-08-16 15:53:43 +12:00
parent f20f9954db
commit 5b8fd361c2
1 changed files with 4 additions and 2 deletions

View File

@ -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__()