Browse Source

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
tags/9.2.0
Pavlo Shchelokovskyy 3 years ago
committed by Pavlo Shchelokovskyy
parent
commit
ca14146e03
5 changed files with 9 additions and 17 deletions
  1. +1
    -0
      .gitignore
  2. +3
    -0
      .stestr.conf
  3. +0
    -4
      .testr.conf
  4. +0
    -9
      doc/source/contributor/dev-quickstart.rst
  5. +5
    -4
      tox.ini

+ 1
- 0
.gitignore View File

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


+ 3
- 0
.stestr.conf View File

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

+ 0
- 4
.testr.conf 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

+ 0
- 9
doc/source/contributor/dev-quickstart.rst View File

@@ -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 <https://pypi.python.org/pypi/os-testr>`_::


+ 5
- 4
tox.ini View File

@@ -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


Loading…
Cancel
Save