Merge "Capture the stdout and stderr based on environment"
This commit is contained in:
commit
79b125b9db
@ -38,8 +38,10 @@ class TestBase(testtools.TestCase):
|
|||||||
|
|
||||||
self.useFixture(fixtures.FakeLogger('zaqar'))
|
self.useFixture(fixtures.FakeLogger('zaqar'))
|
||||||
|
|
||||||
# NOTE(kgriffs): Don't monkey-patch stdout since it breaks
|
if os.environ.get('OS_STDOUT_CAPTURE') is not None:
|
||||||
# debugging with pdb.
|
stdout = self.useFixture(fixtures.StringStream('stdout')).stream
|
||||||
|
self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
|
||||||
|
if os.environ.get('OS_STDERR_CAPTURE') is not None:
|
||||||
stderr = self.useFixture(fixtures.StringStream('stderr')).stream
|
stderr = self.useFixture(fixtures.StringStream('stderr')).stream
|
||||||
self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
|
self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user