From ca14146e03a41e2597cd28fc3a0ba15a4630fc58 Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Tue, 19 Sep 2017 12:34:01 +0000 Subject: [PATCH] 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 --- .gitignore | 1 + .stestr.conf | 3 +++ .testr.conf | 4 ---- doc/source/contributor/dev-quickstart.rst | 9 --------- tox.ini | 9 +++++---- 5 files changed, 9 insertions(+), 17 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 37af5bdbd8..c885b687d4 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ develop-eggs *.DS_Store .idea .testrepository +.stestr .tox .venv .*.swp diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000000..b9113287bb --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${TESTS_DIR:-./ironic/tests/unit/} +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 4e0e03c3c9..0000000000 --- a/.testr.conf +++ /dev/null @@ -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 diff --git a/doc/source/contributor/dev-quickstart.rst b/doc/source/contributor/dev-quickstart.rst index 6928472833..04e4dd12fb 100644 --- a/doc/source/contributor/dev-quickstart.rst +++ b/doc/source/contributor/dev-quickstart.rst @@ -103,15 +103,6 @@ name. For example:: # run the unit tests under py27 and also run the pep8 tests 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. To run a specific unit test, this passes the -r option and desired test (regex string) to `os-testr `_:: diff --git a/tox.ini b/tox.ini index 0e7cbdabd3..2b1c0496d9 100644 --- a/tox.ini +++ b/tox.ini @@ -13,9 +13,7 @@ setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning TESTS_DIR=./ironic/tests/unit/ deps = -r{toxinidir}/test-requirements.txt -whitelist_externals = rm commands = - rm -f .testrepository/times.dbm ostestr {posargs} passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY @@ -44,10 +42,13 @@ commands = [testenv:cover] setenv = VIRTUAL_ENV={envdir} LANGUAGE=en_US + PYTHON=coverage run --source ironic --omit='*tests*' --parallel-mode commands = coverage erase - python setup.py testr --coverage --omit='*test*' --testr-args='{posargs}' - coverage report --omit='*test*' + ostestr {posargs} + coverage combine + coverage report --omit='*tests*' + coverage html -d ./cover --omit='*tests*' [testenv:checkconfig] sitepackages = False