Make test logging setup fixture disable future setup
Our logging fixture sets up logging in a way that we need to capture things during tests. However, some of our tests do things like call back into main functions, which then call logging setup again, and unwind everything we're doing (including debug message testing). This patches out oslo_log setup after the fixture runs, thus ignoring calls to it in the future. It removes a couple of scary looking stack traces from the test stream that shouldn't be there. Change-Id: Ie1b7d4370f20597961a841c5bc0a1ad7cc42b2ef
This commit is contained in:
parent
d18eff38eb
commit
dc2f4f88ac
@ -143,6 +143,17 @@ class StandardLogging(fixtures.Fixture):
|
||||
std_logging.getLogger(
|
||||
'migrate.versioning.api').setLevel(std_logging.WARNING)
|
||||
|
||||
# At times we end up calling back into main() functions in
|
||||
# testing. This has the possibility of calling logging.setup
|
||||
# again, which completely unwinds the logging capture we've
|
||||
# created here. Once we've setup the logging the way we want,
|
||||
# disable the ability for the test to change this.
|
||||
def fake_logging_setup(*args):
|
||||
pass
|
||||
|
||||
self.useFixture(
|
||||
fixtures.MonkeyPatch('oslo_log.log.setup', fake_logging_setup))
|
||||
|
||||
|
||||
class OutputStreamCapture(fixtures.Fixture):
|
||||
"""Capture output streams during tests.
|
||||
|
Loading…
x
Reference in New Issue
Block a user