From 63c8bb5306d15c7679b2cd1d22b6ee556967863d Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Tue, 22 Jan 2013 11:09:11 -0600 Subject: Migrate from nose to testr. Run tests with testr for parallel execution. Part of blueprint grizzly-testtools. Change-Id: I560592186f2f440049a451a32e58067262ab62d0 --- tests/utils.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'tests/utils.py') diff --git a/tests/utils.py b/tests/utils.py index 633442c9..90274725 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,17 +1,20 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -import time +import os +import fixtures import testtools class TestCase(testtools.TestCase): - def setUp(self): super(TestCase, self).setUp() - self._original_time = time.time - time.time = lambda: 1234 + if (os.environ.get("OS_STDOUT_NOCAPTURE") == "True" and + os.environ.get("OS_STDOUT_NOCAPTURE") == "1"): + stdout = self.useFixture(fixtures.StringStream("stdout")).stream + self.useFixture(fixtures.MonkeyPatch("sys.stdout", stdout)) + if (os.environ.get("OS_STDERR_NOCAPTURE") == "True" and + os.environ.get("OS_STDERR_NOCAPTURE") == "1"): + stderr = self.useFixture(fixtures.StringStream("stderr")).stream + self.useFixture(fixtures.MonkeyPatch("sys.stderr", stderr)) def tearDown(self): - time.time = self._original_time super(TestCase, self).tearDown() -- cgit v1.2.1