Use testrepository as the test runner
There are several benefits moving to testr brings
- It reduces the diversity of tools in OpenStack
- testrepository and related components are used in OpenStack Infra
environment for data analisys and deeper integration
- Reduces chances of a new dependency hell because py.test won’t be
added to global-requirements
- Sticking to global requirements is an idea which is in the scope
of discussions around Fuel.
In order to facilitate both running specific tests and debugging
this patch introduces dbgunit and dbgfunc tox environments that
utilize oslotest to run unit and functional tests correspondingly
and respect pdb.
Examples:
- tox -e dbgunit v1.test_parser
- tox -e dbgfunc v1.test_client.TestHandlers.test_env_action
Partial-bug: #1499659
Change-Id: Ia3e9c16bb21a875ceea3ea3a30c12ac8dfabc277
This commit is contained in:
4
.testr.conf
Normal file
4
.testr.conf
Normal file
@@ -0,0 +1,4 @@
|
||||
[DEFAULT]
|
||||
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./fuelclient/tests/unit} $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
||||
@@ -2,11 +2,10 @@ hacking>=0.10.0,<0.11
|
||||
mock>=1.0
|
||||
oslotest>=1.5.1,<1.6.0 # Apache-2.0
|
||||
requests-mock>=0.6.0 # Apache-2.0
|
||||
testrepository>=0.0.18
|
||||
testtools>=0.9.36,!=1.2.0
|
||||
|
||||
# Files beyond this line are not in Global Requirements list
|
||||
# and must be added there.
|
||||
pyprof2calltree>=1.3.2
|
||||
gprof2dot>=2014.09.29
|
||||
pytest<2.8.0
|
||||
pytest-cov>=2.0.0
|
||||
|
||||
16
tox.ini
16
tox.ini
@@ -7,6 +7,7 @@ envlist = py26,py27,pep8,functional,cleanup
|
||||
usedevelop = True
|
||||
install_command = pip install --allow-external -U {opts} {packages}
|
||||
whitelist_externals = bash
|
||||
oslo_debug_helper
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
ARTIFACTS={toxinidir}/{env:ARTIFACTS:test_run}
|
||||
FUELCLIENT_JUNIT={env:FUELCLIENT_JUNIT:fuelclient}-{envname}.xml
|
||||
@@ -29,13 +30,22 @@ setenv = VIRTUAL_ENV={envdir}
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
py.test -vv --junit-xml $FUELCLIENT_JUNIT {posargs:fuelclient/tests/unit}
|
||||
bash -c "TESTS_DIR={posargs:./fuelclient/tests/unit} python setup.py test --slowest"
|
||||
|
||||
[testenv:functional]
|
||||
commands =
|
||||
bash {toxinidir}/tools/cleanup.sh
|
||||
bash {toxinidir}/tools/prepare_nailgun.sh
|
||||
py.test -vv --junit-xml $FUELCLIENT_JUNIT {posargs:fuelclient/tests/functional}
|
||||
bash -c "TESTS_DIR={posargs:./fuelclient/tests/functional} python setup.py test --slowest"
|
||||
|
||||
[testenv:dbgunit]
|
||||
commands = oslo_debug_helper -t {toxinidir}/fuelclient/tests/unit {posargs}
|
||||
|
||||
[testenv:dbgfunc]
|
||||
commands =
|
||||
bash {toxinidir}/tools/cleanup.sh
|
||||
bash {toxinidir}/tools/prepare_nailgun.sh
|
||||
oslo_debug_helper -t {toxinidir}/fuelclient/tests/functional {posargs}
|
||||
|
||||
[testenv:cleanup]
|
||||
commands =
|
||||
@@ -53,7 +63,7 @@ commands =
|
||||
|
||||
[testenv:cover]
|
||||
commands =
|
||||
py.test -vv --junit-xml $FUELCLIENT_JUNIT --cov=fuelclient {posargs:fuelclient/tests/unit}
|
||||
bash -c "TESTS_DIR={posargs:./fuelclient/tests/unit} python setup.py testr --coverage"
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs:}
|
||||
|
||||
Reference in New Issue
Block a user