Merge "Invert test stream capture logic for debugging."
This commit is contained in:
commit
50cd91fd1a
|
@ -1,4 +1,4 @@
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
test_command=${PYTHON:-python} -m subunit.run discover -t ./ ./nova/tests $LISTOPT $IDOPTION
|
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ ./nova/tests $LISTOPT $IDOPTION
|
||||||
test_id_option=--load-list $IDFILE
|
test_id_option=--load-list $IDFILE
|
||||||
test_list_option=--list
|
test_list_option=--list
|
||||||
|
|
18
nova/test.py
18
nova/test.py
|
@ -189,17 +189,23 @@ class TestCase(testtools.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Run before each test method to initialize test environment."""
|
"""Run before each test method to initialize test environment."""
|
||||||
super(TestCase, self).setUp()
|
super(TestCase, self).setUp()
|
||||||
# Give each test a maximum of one minute to run.
|
test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)
|
||||||
self.useFixture(fixtures.Timeout(60, gentle=True))
|
try:
|
||||||
|
test_timeout = int(test_timeout)
|
||||||
|
except ValueError:
|
||||||
|
# If timeout value is invalid do not set a timeout.
|
||||||
|
test_timeout = 0
|
||||||
|
if test_timeout > 0:
|
||||||
|
self.useFixture(fixtures.Timeout(test_timeout, gentle=True))
|
||||||
self.useFixture(fixtures.NestedTempfile())
|
self.useFixture(fixtures.NestedTempfile())
|
||||||
self.useFixture(fixtures.TempHomeDir())
|
self.useFixture(fixtures.TempHomeDir())
|
||||||
|
|
||||||
if (os.environ.get('OS_STDOUT_NOCAPTURE') != 'True' and
|
if (os.environ.get('OS_STDOUT_CAPTURE') == 'True' or
|
||||||
os.environ.get('OS_STDOUT_NOCAPTURE') != '1'):
|
os.environ.get('OS_STDOUT_CAPTURE') == '1'):
|
||||||
stdout = self.useFixture(fixtures.StringStream('stdout')).stream
|
stdout = self.useFixture(fixtures.StringStream('stdout')).stream
|
||||||
self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
|
self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
|
||||||
if (os.environ.get('OS_STDERR_NOCAPTURE') != 'True' and
|
if (os.environ.get('OS_STDERR_CAPTURE') == 'True' or
|
||||||
os.environ.get('OS_STDERR_NOCAPTURE') != '1'):
|
os.environ.get('OS_STDERR_CAPTURE') == '1'):
|
||||||
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))
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,6 @@ recreate_db=1
|
||||||
LANG=en_US.UTF-8
|
LANG=en_US.UTF-8
|
||||||
LANGUAGE=en_US:en
|
LANGUAGE=en_US:en
|
||||||
LC_ALL=C
|
LC_ALL=C
|
||||||
OS_STDOUT_NOCAPTURE=False
|
|
||||||
OS_STDERR_NOCAPTURE=False
|
|
||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
process_option $arg
|
process_option $arg
|
||||||
|
|
3
tox.ini
3
tox.ini
|
@ -6,9 +6,6 @@ setenv = VIRTUAL_ENV={envdir}
|
||||||
LANG=en_US.UTF-8
|
LANG=en_US.UTF-8
|
||||||
LANGUAGE=en_US:en
|
LANGUAGE=en_US:en
|
||||||
LC_ALL=C
|
LC_ALL=C
|
||||||
OS_STDOUT_NOCAPTURE=False
|
|
||||||
OS_STDERR_NOCAPTURE=False
|
|
||||||
|
|
||||||
deps = -r{toxinidir}/tools/pip-requires
|
deps = -r{toxinidir}/tools/pip-requires
|
||||||
-r{toxinidir}/tools/test-requires
|
-r{toxinidir}/tools/test-requires
|
||||||
commands = bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi'
|
commands = bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi'
|
||||||
|
|
Loading…
Reference in New Issue