From bfeffb63667b796999997acf43be395d31b6a184 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 27 Dec 2012 15:26:50 -0800 Subject: [PATCH] Use testr instead of nose. nose is invasive and can sometimes alter the outcome of a test run. testr, on the other hand, keeps a distinction between running tests and displaying results of the test runs. Additionally, it supports the stock python unittest protocol. Even better, testr supports parallel test running, which makes things faster, and a command "testr run --failing" which will just re-run the latest failing tests (often something one wants to do in iterative dev) Part of blueprint grizzly-testtools Change-Id: I0b3f1bcb5d4ff59c65eb3219b30a9e64f54d70bd --- .gitignore | 2 ++ .testr.conf | 4 ++++ .unittests | 7 ++++--- setup.cfg | 9 --------- setup.py | 1 - tools/test-requires | 8 +++----- tox.ini | 29 ++++++----------------------- 7 files changed, 19 insertions(+), 41 deletions(-) create mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 667aaf9..63282cc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ dist/ *.py[co] .DS_Store *.log +.testrepository +subunit.log build swiftclient/versioninfo .autogenerated diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 0000000..081907d --- /dev/null +++ b/.testr.conf @@ -0,0 +1,4 @@ +[DEFAULT] +test_command=${PYTHON:-python} -m subunit.run discover -t ./ ./tests $LISTOPT $IDOPTION +test_id_option=--load-list $IDFILE +test_list_option=--list diff --git a/.unittests b/.unittests index b977da4..4758296 100755 --- a/.unittests +++ b/.unittests @@ -1,7 +1,8 @@ #!/bin/bash set -e -nosetests --exe --with-coverage --cover-package swiftclient --cover-erase $@ -rvalue=$? +python setup.py testr --coverage +RET=$? +coverage report rm -f .coverage -exit $rvalue +exit $RET diff --git a/setup.cfg b/setup.cfg index ca5fb62..11c7201 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,12 +1,3 @@ -[nosetests] -cover-package = swiftclient -cover-html = true -cover-erase = true -cover-inclusive = true -verbosity=2 -detailed-errors=1 -where = tests - [build_sphinx] source-dir = doc/source build-dir = doc/build diff --git a/setup.py b/setup.py index 9de50ab..beb6c23 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,6 @@ setuptools.setup( 'Programming Language :: Python :: 2.6', 'Environment :: No Input/Output (Daemon)', ], - test_suite='nose.collector', scripts=[ 'bin/swift', ], diff --git a/tools/test-requires b/tools/test-requires index eaaf9eb..ea2ca29 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -1,12 +1,10 @@ distribute>=0.6.24 +coverage +discover eventlet -nose -nose-exclude -nosehtmloutput -nosexcover -openstack.nose_plugin pep8==1.3 python-keystoneclient sphinx>=1.1.2 +testrepository>=0.0.13 testtools>=0.9.22 diff --git a/tox.ini b/tox.ini index 4641141..d1eb896 100644 --- a/tox.ini +++ b/tox.ini @@ -3,14 +3,13 @@ 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 + LANG=en_US.UTF-8 + LANGUAGE=en_US:en + LC_ALL=C + deps = -r{toxinidir}/tools/pip-requires -r{toxinidir}/tools/test-requires -commands = nosetests +commands = python setup.py testr --testr-args="{posargs}" [testenv:pep8] deps = pep8 @@ -20,23 +19,7 @@ commands = pep8 --repeat --show-source --exclude=openstack swiftclient setup.py commands = {posargs} [testenv:cover] -commands = nosetests --cover-erase --cover-package=swiftclient --with-xcoverage +commands = python setup.py testr --coverage [tox:jenkins] downloadcache = ~/cache/pip - -[testenv:jenkins26] -basepython = python2.6 -setenv = NOSE_WITH_XUNIT=1 - -[testenv:jenkins27] -basepython = python2.7 -setenv = NOSE_WITH_XUNIT=1 - -[testenv:jenkinscover] -setenv = NOSE_WITH_XUNIT=1 -commands = nosetests --cover-erase --cover-package=swiftclient --with-xcoverage - -[testenv:jenkinsvenv] -setenv = NOSE_WITH_XUNIT=1 -commands = {posargs}