Use testr instead of nosetest
This patch removes the dependency on nosetest and uses testrepository as a test runner. There are some advantages behind this change: - Better tests execution - Better tests concurrency - Less dependencies Change-Id: I1985bdf03137d32a0774321d8dec5cb015dc9d2f
This commit is contained in:
parent
1765a8c3b8
commit
e82e5fe3c0
8
.testr.conf
Normal file
8
.testr.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
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 . ./tests $LISTOPT $IDOPTION
|
||||||
|
|
||||||
|
test_id_option=--load-list $IDFILE
|
||||||
|
test_list_option=--list
|
@ -15,8 +15,3 @@ testtools>=0.9.32
|
|||||||
|
|
||||||
# Functional Tests
|
# Functional Tests
|
||||||
requests>=1.1
|
requests>=1.1
|
||||||
|
|
||||||
# Test runner
|
|
||||||
nose
|
|
||||||
nose-exclude
|
|
||||||
openstack.nose_plugin>=0.7
|
|
||||||
|
@ -18,6 +18,7 @@ import io
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import falcon
|
import falcon
|
||||||
|
import six
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from marconi.queues.transport.wsgi import utils
|
from marconi.queues.transport.wsgi import utils
|
||||||
@ -100,7 +101,7 @@ class TestWSGIutils(testtools.TestCase):
|
|||||||
|
|
||||||
def test_no_spec(self):
|
def test_no_spec(self):
|
||||||
obj = {u'body': {'event': 'start_backup'}, 'ttl': 300}
|
obj = {u'body': {'event': 'start_backup'}, 'ttl': 300}
|
||||||
document = json.dumps(obj, ensure_ascii=False)
|
document = six.text_type(json.dumps(obj, ensure_ascii=False))
|
||||||
doc_stream = io.StringIO(document)
|
doc_stream = io.StringIO(document)
|
||||||
|
|
||||||
filtered = utils.filter_stream(doc_stream, len(document), spec=None)
|
filtered = utils.filter_stream(doc_stream, len(document), spec=None)
|
||||||
@ -113,7 +114,7 @@ class TestWSGIutils(testtools.TestCase):
|
|||||||
|
|
||||||
def test_no_spec_array(self):
|
def test_no_spec_array(self):
|
||||||
things = [{u'body': {'event': 'start_backup'}, 'ttl': 300}]
|
things = [{u'body': {'event': 'start_backup'}, 'ttl': 300}]
|
||||||
document = json.dumps(things, ensure_ascii=False)
|
document = six.text_type(json.dumps(things, ensure_ascii=False))
|
||||||
doc_stream = io.StringIO(document)
|
doc_stream = io.StringIO(document)
|
||||||
|
|
||||||
filtered = utils.filter_stream(doc_stream, len(document),
|
filtered = utils.filter_stream(doc_stream, len(document),
|
||||||
@ -131,7 +132,7 @@ class TestWSGIutils(testtools.TestCase):
|
|||||||
def test_filter_stream_expect_obj(self):
|
def test_filter_stream_expect_obj(self):
|
||||||
obj = {u'body': {'event': 'start_backup'}, 'id': 'DEADBEEF'}
|
obj = {u'body': {'event': 'start_backup'}, 'id': 'DEADBEEF'}
|
||||||
|
|
||||||
document = json.dumps(obj, ensure_ascii=False)
|
document = six.text_type(json.dumps(obj, ensure_ascii=False))
|
||||||
stream = io.StringIO(document)
|
stream = io.StringIO(document)
|
||||||
spec = [('body', dict), ('id', basestring)]
|
spec = [('body', dict), ('id', basestring)]
|
||||||
filtered_object, = utils.filter_stream(stream, len(document), spec)
|
filtered_object, = utils.filter_stream(stream, len(document), spec)
|
||||||
@ -146,7 +147,7 @@ class TestWSGIutils(testtools.TestCase):
|
|||||||
def test_filter_stream_expect_array(self):
|
def test_filter_stream_expect_array(self):
|
||||||
array = [{u'body': {u'x': 1}}, {u'body': {u'x': 2}}]
|
array = [{u'body': {u'x': 1}}, {u'body': {u'x': 2}}]
|
||||||
|
|
||||||
document = json.dumps(array, ensure_ascii=False)
|
document = six.text_type(json.dumps(array, ensure_ascii=False))
|
||||||
stream = io.StringIO(document)
|
stream = io.StringIO(document)
|
||||||
spec = [('body', dict)]
|
spec = [('body', dict)]
|
||||||
filtered_objects = list(utils.filter_stream(
|
filtered_objects = list(utils.filter_stream(
|
||||||
|
15
tox.ini
15
tox.ini
@ -8,15 +8,13 @@ usedevelop = True
|
|||||||
# Customize pip command, add -U to force updates.
|
# Customize pip command, add -U to force updates.
|
||||||
install_command = pip install -U {opts} {packages}
|
install_command = pip install -U {opts} {packages}
|
||||||
setenv = VIRTUAL_ENV={envdir}
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
NOSE_WITH_OPENSTACK=1
|
MARCONI_TESTS_DIR={toxinidir}/tests
|
||||||
NOSE_OPENSTACK_COLOR=1
|
MARCONI_TESTS_CONFIGS_DIR={toxinidir}/tests/etc/
|
||||||
NOSE_OPENSTACK_RED=0.05
|
|
||||||
NOSE_OPENSTACK_YELLOW=0.025
|
|
||||||
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
|
||||||
NOSE_OPENSTACK_STDOUT=1
|
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
commands = nosetests {posargs}
|
#commands = nosetests {posargs}
|
||||||
|
commands = python setup.py testr --slowest --testr-args='--concurrency 1 {posargs}'
|
||||||
|
|
||||||
[tox:jenkins]
|
[tox:jenkins]
|
||||||
downloadcache = ~/cache/pip
|
downloadcache = ~/cache/pip
|
||||||
@ -26,6 +24,9 @@ commands = flake8
|
|||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
setenv = NOSE_WITH_COVERAGE=1
|
setenv = NOSE_WITH_COVERAGE=1
|
||||||
|
commands =
|
||||||
|
python setup.py testr --coverage \
|
||||||
|
--testr-args='^(?!.*test.*coverage).*$'
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
Loading…
Reference in New Issue
Block a user