Add environmental variables to test.conf
This commit adds environmental variables to .testr.conf to disable testr capturing STDOUT and STDERR by default. So now STDOUT and STDERR will print immediately by default when using testr. It also adds a default 250 sec timeout for tests. If a test takes longer than this it will fail. Change-Id: I32d8b1a856f6e7932d16b1464553e9c25fbc3cfc
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
[DEFAULT]
|
||||
test_command=${PYTHON:-python} -m subunit.run discover -t ./ ./tempest $LISTOPT $IDOPTION
|
||||
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-250} \
|
||||
${PYTHON:-python} -m subunit.run discover -t ./ ./tempest $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
||||
group_regex=([^\.]*\.)*
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
import fixtures
|
||||
import nose.plugins.attrib
|
||||
import testresources
|
||||
import testtools
|
||||
@@ -105,6 +106,25 @@ class BaseTestCase(testtools.TestCase,
|
||||
if hasattr(super(BaseTestCase, cls), 'setUpClass'):
|
||||
super(BaseTestCase, cls).setUpClass()
|
||||
|
||||
def setUp(cls):
|
||||
super(BaseTestCase, cls).setUp()
|
||||
test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)
|
||||
try:
|
||||
test_timeout = int(test_timeout)
|
||||
except ValueError:
|
||||
test_timeout = 0
|
||||
if test_timeout > 0:
|
||||
cls.useFixture(fixtures.Timeout(test_timeout, gentle=True))
|
||||
|
||||
if (os.environ.get('OS_STDOUT_CAPTURE') == 'True' or
|
||||
os.environ.get('OS_STDOUT_CAPTURE') == '1'):
|
||||
stdout = cls.useFixture(fixtures.StringStream('stdout')).stream
|
||||
cls.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
|
||||
if (os.environ.get('OS_STDERR_CAPTURE') == 'True' or
|
||||
os.environ.get('OS_STDERR_CAPTURE') == '1'):
|
||||
stderr = cls.useFixture(fixtures.StringStream('stderr')).stream
|
||||
cls.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
|
||||
|
||||
@classmethod
|
||||
def _get_identity_admin_client(cls):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user