Migrate to stestr as unit tests runner

Recent update brought os-testr 1.0.0 that already uses stestr test
runner instead of testrepository.

This patch migrates those places using testrepository to using stestr.

Change-Id: I793617e042b38aea4cb177b51b6a7ba4a9268f3c
This commit is contained in:
Pavlo Shchelokovskyy 2017-09-19 12:34:01 +00:00 committed by Pavlo Shchelokovskyy
parent 76ba2523c5
commit ca14146e03
5 changed files with 9 additions and 17 deletions

1
.gitignore vendored
View File

@ -29,6 +29,7 @@ develop-eggs
*.DS_Store *.DS_Store
.idea .idea
.testrepository .testrepository
.stestr
.tox .tox
.venv .venv
.*.swp .*.swp

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=${TESTS_DIR:-./ironic/tests/unit/}
top_dir=./

View File

@ -1,4 +0,0 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ ${TESTS_DIR:-./ironic/tests/unit/} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -103,15 +103,6 @@ name. For example::
# run the unit tests under py27 and also run the pep8 tests # run the unit tests under py27 and also run the pep8 tests
tox -epy27 -epep8 tox -epy27 -epep8
.. note::
If tests are run under py27 and then run under py35 the following error may occur::
db type could not be determined
ERROR: InvocationError: '/home/ubuntu/ironic/.tox/py35/bin/ostestr'
To overcome this error remove the file `.testrepository/times.dbm`
and then run the py35 test.
You may pass options to the test programs using positional arguments. You may pass options to the test programs using positional arguments.
To run a specific unit test, this passes the -r option and desired test To run a specific unit test, this passes the -r option and desired test
(regex string) to `os-testr <https://pypi.python.org/pypi/os-testr>`_:: (regex string) to `os-testr <https://pypi.python.org/pypi/os-testr>`_::

View File

@ -13,9 +13,7 @@ setenv = VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning PYTHONWARNINGS=default::DeprecationWarning
TESTS_DIR=./ironic/tests/unit/ TESTS_DIR=./ironic/tests/unit/
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
whitelist_externals = rm
commands = commands =
rm -f .testrepository/times.dbm
ostestr {posargs} ostestr {posargs}
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
@ -44,10 +42,13 @@ commands =
[testenv:cover] [testenv:cover]
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
LANGUAGE=en_US LANGUAGE=en_US
PYTHON=coverage run --source ironic --omit='*tests*' --parallel-mode
commands = commands =
coverage erase coverage erase
python setup.py testr --coverage --omit='*test*' --testr-args='{posargs}' ostestr {posargs}
coverage report --omit='*test*' coverage combine
coverage report --omit='*tests*'
coverage html -d ./cover --omit='*tests*'
[testenv:checkconfig] [testenv:checkconfig]
sitepackages = False sitepackages = False