Use testr instead of nosetests

This commit replaces the use of nosetests with testr to be consistent
with the tools used elsewhere in OpenStack. The required changes were
minimum.

A test was duplicated to avoid a duplication id error in testr. This
could be refactored using mixins in follow-up patches.

Change-Id: Ic854fec120992db99dcb47cc90e5ca785c9bd056
This commit is contained in:
Flavio Percoco
2016-09-21 15:48:22 +02:00
parent 1d138da0ca
commit 006c92acd9
5 changed files with 15 additions and 9 deletions

View File

@@ -2,6 +2,6 @@
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
${PYTHON:-python} -m subunit.run discover -t ${OS_TOP_LEVEL:-./} ${OS_TEST_PATH:-./tests/unit} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@@ -44,12 +44,6 @@ class BaseTestStorletMiddleware(unittest.TestCase):
factory = storlet_handler.filter_factory(global_conf, **local_conf)
return factory(app)
def test_load_app(self):
try:
self.get_app(self.base_app, self.conf)
except Exception:
self.fail('Application loading got an error')
def get_response(self, req):
app = self.get_app(self.base_app, self.conf)
return req.get_response(app)

View File

@@ -27,6 +27,12 @@ class TestStorletMiddlewareObject(BaseTestStorletMiddleware):
def setUp(self):
super(TestStorletMiddlewareObject, self).setUp(exec_server='object')
def test_load_app(self):
try:
self.get_app(self.base_app, self.conf)
except Exception:
self.fail('Application loading got an error')
def test_call_unsupported_method(self):
def call(method):
path = '/sda1/p/AUTH_a/c/o'

View File

@@ -44,6 +44,12 @@ class TestStorletMiddlewareProxy(BaseTestStorletMiddleware):
def setUp(self):
super(TestStorletMiddlewareProxy, self).setUp(exec_server='proxy')
def test_load_app(self):
try:
self.get_app(self.base_app, self.conf)
except Exception:
self.fail('Application loading got an error')
def test_GET_without_storlets(self):
def basic_get(path):
req = Request.blank(

View File

@@ -16,7 +16,7 @@ deps =
commands =
find . -type f -name "*.py[c|o]" -delete
find . -type d -name "__pycache__" -delete
nosetests {posargs:tests/unit} -v
python setup.py testr --slowest --testr-args='--concurrency 1 {posargs:tests.unit}'
whitelist_externals = bash
find
@@ -42,7 +42,7 @@ commands = ./.functests jenkins
commands = {posargs}
[testenv:cover]
commands = python setup.py test --coverage --testr-args='{posargs}'
commands = python setup.py testr --coverage --testr-args='{posargs}'
[testenv:docs]
commands = python setup.py build_sphinx