diff options
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | tempest/cli/__init__.py | 36 | ||||
-rw-r--r-- | tempest/test.py | 19 |
3 files changed, 37 insertions, 19 deletions
diff --git a/requirements.txt b/requirements.txt index ac7201742..4a889a8e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,6 @@ python-heatclient>=0.2.9 python-ironicclient>=0.2.1 python-saharaclient>=0.7.3 python-swiftclient>=2.2.0 -testresources>=0.2.4 testrepository>=0.0.18 oslo.config>=1.4.0 # Apache-2.0 six>=1.7.0 diff --git a/tempest/cli/__init__.py b/tempest/cli/__init__.py index 8dd2df2de..47821299b 100644 --- a/tempest/cli/__init__.py +++ b/tempest/cli/__init__.py @@ -16,6 +16,7 @@ import functools from tempest_lib.cli import base +from tempest_lib.cli import output_parser import testtools from tempest.common import credentials @@ -66,7 +67,7 @@ def min_client_version(*args, **kwargs): return decorator -class ClientTestBase(base.ClientTestBase, test.BaseTestCase): +class ClientTestBase(test.BaseTestCase): @classmethod def resource_setup(cls): if not CONF.cli.enabled: @@ -82,3 +83,36 @@ class ClientTestBase(base.ClientTestBase, test.BaseTestCase): self.creds.tenant_name, CONF.identity.uri, CONF.cli.cli_dir) return clients + + # TODO(mtreinish): The following code is basically copied from tempest-lib. + # The base cli test class in tempest-lib 0.0.1 doesn't work as a mixin like + # is needed here. The code below should be removed when tempest-lib + # provides a way to provide this functionality + def setUp(self): + super(ClientTestBase, self).setUp() + self.clients = self._get_clients() + self.parser = output_parser + + def assertTableStruct(self, items, field_names): + """Verify that all items has keys listed in field_names. + + :param items: items to assert are field names in the output table + :type items: list + :param field_names: field names from the output table of the cmd + :type field_names: list + """ + for item in items: + for field in field_names: + self.assertIn(field, item) + + def assertFirstLineStartsWith(self, lines, beginning): + """Verify that the first line starts with a string + + :param lines: strings for each line of output + :type lines: list + :param beginning: verify this is at the beginning of the first line + :type beginning: string + """ + self.assertTrue(lines[0].startswith(beginning), + msg=('Beginning of first line has invalid content: %s' + % lines[:3])) diff --git a/tempest/test.py b/tempest/test.py index db8736ef3..14cf3bb79 100644 --- a/tempest/test.py +++ b/tempest/test.py @@ -24,7 +24,6 @@ import urllib import uuid import fixtures -import testresources import testscenarios import testtools @@ -222,23 +221,9 @@ def validate_tearDownClass(): atexit.register(validate_tearDownClass) -if sys.version_info >= (2, 7): - class BaseDeps(testtools.TestCase, - testtools.testcase.WithAttributes, - testresources.ResourcedTestCase): - pass -else: - # Define asserts for py26 - import unittest2 - - class BaseDeps(testtools.TestCase, - testtools.testcase.WithAttributes, - testresources.ResourcedTestCase, - unittest2.TestCase): - pass - -class BaseTestCase(BaseDeps): +class BaseTestCase(testtools.testcase.WithAttributes, + testtools.TestCase): setUpClassCalled = False _service = None |