diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 000000000..d356fcf1e --- /dev/null +++ b/.testr.conf @@ -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 diff --git a/HACKING.rst b/HACKING.rst index d99a07f9a..c7643238e 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -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 diff --git a/setup.cfg b/setup.cfg index 394b128fe..11d2c4422 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/tools/test-requires b/tools/test-requires index 12622f2e2..b82e805ed 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -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 diff --git a/tox.ini b/tox.ini index fce1185cf..c9d960819 100644 --- a/tox.ini +++ b/tox.ini @@ -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