From f6f7bcfa1aad821515e82b9734c418da650682e4 Mon Sep 17 00:00:00 2001 From: Monty Taylor <mordred@inaugust.com> Date: Tue, 8 Jan 2013 06:26:00 +0000 Subject: [PATCH] Migrate from nose to testr Part of blueprint grizzly-testtools Change-Id: Ia53b0987b1e890a96b190f4b1a47dde4bf84fb6f --- .testr.conf | 4 ++++ HACKING.rst | 19 +++++++++++++++++++ setup.cfg | 4 ---- tools/test-requires | 14 +++++++------- tox.ini | 24 +++++++++++------------- 5 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 .testr.conf diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 0000000..d356fcf diff --git a/HACKING.rst b/HACKING.rst index d99a07f..c764323 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 6d19c21..14dcb5c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,10 +3,6 @@ all_files = 1 build-dir = doc/build source-dir = doc/source -[nosetests] -verbosity = 2 -detailed-errors = 1 - [egg_info] tag_build = tag_date = 0 diff --git a/tools/test-requires b/tools/test-requires index 8b02c3b..b82e805 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -1,11 +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 - +testrepository>=0.0.13 +testtools>=0.9.22 diff --git a/tox.ini b/tox.ini index fce1185..c9d9608 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