Migrate from nose to testr

Part of blueprint grizzly-testtools

Change-Id: Ia53b0987b1e890a96b190f4b1a47dde4bf84fb6f
This commit is contained in:
Monty Taylor 2013-01-08 06:26:00 +00:00
parent 2bca8ee440
commit fe4b3498b9
5 changed files with 40 additions and 28 deletions

4
.testr.conf Normal file
View File

@ -0,0 +1,4 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ./quantumclient/tests $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -185,3 +185,22 @@ For every new feature, unit tests should be created that both test and
bug that had no unit test, a new passing unit test should be added. If a
submitted bug fix does have a unit test, be sure to add a new one that fails
without the patch and passes with the patch.
Running Tests
-------------
The testing system is based on a combination of tox and testr. The canonical
approach to running tests is to simply run the command `tox`. This will
create virtual environments, populate them with depenedencies and run all of
the tests that OpenStack CI systems run. Behind the scenes, tox is running
`testr run --parallel`, but is set up such that you can supply any additional
testr arguments that are needed to tox. For example, you can run:
`tox -- --analyze-isolation` to cause tox to tell testr to add
--analyze-isolation to its argument list.
It is also possible to run the tests inside of a virtual environment
you have created, or it is possible that you have all of the dependencies
installed locally already. In this case, you can interact with the testr
command directly. Running `testr run` will run the entire test suite. `testr
run --parallel` will run it in parallel (this is the default incantation tox
uses.) More information about testr can be found at:
http://wiki.openstack.org/testr

View File

@ -2,11 +2,3 @@
all_files = 1
build-dir = doc/build
source-dir = doc/source
[nosetests]
# NOTE(jkoelker) To run the test suite under nose install the following
# coverage http://pypi.python.org/pypi/coverage
# tissue http://pypi.python.org/pypi/tissue (pep8 checker)
# openstack-nose https://github.com/jkoelker/openstack-nose
verbosity=2
detailed-errors=1

View File

@ -1,12 +1,11 @@
distribute>=0.6.24
cliff-tablib>=1.0
coverage
discover
distribute>=0.6.24
fixtures>=0.3.12
mox
nose
nose-exclude
nosexcover
openstack.nose_plugin
nosehtmloutput
pep8
python-subunit
sphinx>=1.1.2
testtools
testrepository>=0.0.13
testtools>=0.9.22

24
tox.ini
View File

@ -3,23 +3,21 @@ envlist = py26,py27,pep8
[testenv]
setenv = VIRTUAL_ENV={envdir}
NOSE_WITH_OPENSTACK=1
NOSE_OPENSTACK_COLOR=1
NOSE_OPENSTACK_RED=0.05
NOSE_OPENSTACK_YELLOW=0.025
NOSE_OPENSTACK_SHOW_ELAPSED=1
NOSE_OPENSTACK_STDOUT=1
deps = -r{toxinidir}/tools/test-requires
commands = nosetests {posargs}
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
[tox:jenkins]
downloadcache = ~/cache/pip
deps = -r{toxinidir}/tools/test-requires
commands = python setup.py testr --testr-args='{posargs}'
[testenv:pep8]
commands = pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc .
[testenv:cover]
setenv = NOSE_WITH_COVERAGE=1
[testenv:venv]
commands = {posargs}
[testenv:cover]
commands = python setup.py testr --coverage --testr-args='{posargs}'
[tox:jenkins]
downloadcache = ~/cache/pip