Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.

Commit fe4b349

Browse files
committed
Migrate from nose to testr
Part of blueprint grizzly-testtools Change-Id: Ia53b0987b1e890a96b190f4b1a47dde4bf84fb6f
1 parent 2bca8ee commit fe4b349

File tree

5 files changed

+40
-28
lines changed

5 files changed

+40
-28
lines changed

.testr.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[DEFAULT]
2+
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ./quantumclient/tests $LISTOPT $IDOPTION
3+
test_id_option=--load-list $IDFILE
4+
test_list_option=--list

HACKING.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,22 @@ For every new feature, unit tests should be created that both test and
185185
bug that had no unit test, a new passing unit test should be added. If a
186186
submitted bug fix does have a unit test, be sure to add a new one that fails
187187
without the patch and passes with the patch.
188+
189+
Running Tests
190+
-------------
191+
The testing system is based on a combination of tox and testr. The canonical
192+
approach to running tests is to simply run the command `tox`. This will
193+
create virtual environments, populate them with depenedencies and run all of
194+
the tests that OpenStack CI systems run. Behind the scenes, tox is running
195+
`testr run --parallel`, but is set up such that you can supply any additional
196+
testr arguments that are needed to tox. For example, you can run:
197+
`tox -- --analyze-isolation` to cause tox to tell testr to add
198+
--analyze-isolation to its argument list.
199+
200+
It is also possible to run the tests inside of a virtual environment
201+
you have created, or it is possible that you have all of the dependencies
202+
installed locally already. In this case, you can interact with the testr
203+
command directly. Running `testr run` will run the entire test suite. `testr
204+
run --parallel` will run it in parallel (this is the default incantation tox
205+
uses.) More information about testr can be found at:
206+
http://wiki.openstack.org/testr

setup.cfg

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,3 @@
22
all_files = 1
33
build-dir = doc/build
44
source-dir = doc/source
5-
6-
[nosetests]
7-
# NOTE(jkoelker) To run the test suite under nose install the following
8-
# coverage http://pypi.python.org/pypi/coverage
9-
# tissue http://pypi.python.org/pypi/tissue (pep8 checker)
10-
# openstack-nose https://github.com/jkoelker/openstack-nose
11-
verbosity=2
12-
detailed-errors=1

tools/test-requires

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
distribute>=0.6.24
21
cliff-tablib>=1.0
2+
coverage
3+
discover
4+
distribute>=0.6.24
35
fixtures>=0.3.12
46
mox
5-
nose
6-
nose-exclude
7-
nosexcover
8-
openstack.nose_plugin
9-
nosehtmloutput
107
pep8
8+
python-subunit
119
sphinx>=1.1.2
12-
testtools
10+
testrepository>=0.0.13
11+
testtools>=0.9.22

tox.ini

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,21 @@ envlist = py26,py27,pep8
33

44
[testenv]
55
setenv = VIRTUAL_ENV={envdir}
6-
NOSE_WITH_OPENSTACK=1
7-
NOSE_OPENSTACK_COLOR=1
8-
NOSE_OPENSTACK_RED=0.05
9-
NOSE_OPENSTACK_YELLOW=0.025
10-
NOSE_OPENSTACK_SHOW_ELAPSED=1
11-
NOSE_OPENSTACK_STDOUT=1
12-
deps = -r{toxinidir}/tools/test-requires
13-
commands = nosetests {posargs}
6+
LANG=en_US.UTF-8
7+
LANGUAGE=en_US:en
8+
LC_ALL=C
149

15-
[tox:jenkins]
16-
downloadcache = ~/cache/pip
10+
deps = -r{toxinidir}/tools/test-requires
11+
commands = python setup.py testr --testr-args='{posargs}'
1712

1813
[testenv:pep8]
1914
commands = pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc .
2015

21-
[testenv:cover]
22-
setenv = NOSE_WITH_COVERAGE=1
23-
2416
[testenv:venv]
2517
commands = {posargs}
18+
19+
[testenv:cover]
20+
commands = python setup.py testr --coverage --testr-args='{posargs}'
21+
22+
[tox:jenkins]
23+
downloadcache = ~/cache/pip

0 commit comments

Comments
 (0)