Merge "Add locking to test_aggregates"
diff --git a/.testr.conf b/.testr.conf
index 9a72d29..510f4c9 100644
--- a/.testr.conf
+++ b/.testr.conf
@@ -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=([^\.]*\.)*
diff --git a/tempest/cli/simple_read_only/test_neutron.py b/tempest/cli/simple_read_only/test_neutron.py
index 2b14e9a..4860090 100644
--- a/tempest/cli/simple_read_only/test_neutron.py
+++ b/tempest/cli/simple_read_only/test_neutron.py
@@ -19,7 +19,6 @@
import subprocess
from oslo.config import cfg
-import testtools
import tempest.cli
from tempest.openstack.common import log as logging
@@ -36,9 +35,13 @@
These tests do not presume any content, nor do they create
their own. They only verify the structure of output if present.
"""
- if (not CONF.service_available.neutron):
- msg = "Skiping all Neutron cli tests because it is not available"
- raise testtools.TestCase.skipException(msg)
+
+ @classmethod
+ def setUpClass(cls):
+ if (not CONF.service_available.neutron):
+ msg = "Skiping all Neutron cli tests because it is not available"
+ raise cls.skipException(msg)
+ super(SimpleReadOnlyNeutronClientTest, cls).setUpClass()
def test_neutron_fake_action(self):
self.assertRaises(subprocess.CalledProcessError,
diff --git a/tempest/test.py b/tempest/test.py
index 4a1ee47..6c304c3 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -18,6 +18,7 @@
import os
import time
+import fixtures
import nose.plugins.attrib
import testresources
import testtools
@@ -104,6 +105,25 @@
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):
"""