Add debug logging to unit test base class

Sometimes tests run long and it's hard to figure out which operation
wasn't mocked out. Enabling debug logging before the logging fixture
means that the debug logging is produced, but is still shoved into the
fixture. If you run a test via testtools.run or something similar,
you'll see both the operations and any print statements, but running
normally under testr it's all silent.

Change-Id: I38de01f6fdb57274eef93100d885f7a062e7167a
This commit is contained in:
Monty Taylor 2016-08-20 12:21:36 -05:00
parent 3462561c46
commit 829ebda93f
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594

View File

@ -20,6 +20,8 @@ import os
import fixtures
import testtools
import shade
_TRUE_VALUES = ('true', '1', 'yes')
@ -50,4 +52,5 @@ class TestCase(testtools.TestCase):
stderr = self.useFixture(fixtures.StringStream('stderr')).stream
self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
shade.simple_logging(debug=True)
self.log_fixture = self.useFixture(fixtures.FakeLogger())