From 35adf2c8da7d586368c10f30e9a5475040f43848 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Mon, 25 Sep 2017 14:03:14 -0700 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. Inspired by the patch of the same name in openstack/ironic Change-Id: I49bd08a402663bfabe1fea14957435ee071145e7 --- .gitignore | 1 + .stestr.conf | 3 +++ .testr.conf | 10 ---------- tox.ini | 7 ++++++- 4 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 195ce07e..27561e7e 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ develop-eggs # Other *.DS_Store +.stestr .testrepository .tox .venv diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 00000000..7ff3312b --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${TESTS_DIR:-./ironic_lib/tests} +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 74f11397..00000000 --- a/.testr.conf +++ /dev/null @@ -1,10 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - OS_DEBUG=${OS_DEBUG:-0} \ - ${PYTHON:-python} -m subunit.run discover -t ./ $LISTOPT $IDOPTION - -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/tox.ini b/tox.ini index 0be52f3b..82fd2cc9 100644 --- a/tox.ini +++ b/tox.ini @@ -36,8 +36,13 @@ commands = [testenv:cover] setenv = VIRTUALENV={envdir} LANGUAGE=en_US + PYTHON=coverage run --source ironic_lib --omit='*tests*' --parallel-mode commands = - python setup.py test --coverage --coverage-package-name=ironic_lib --omit=ironic_lib/openstack/common/*.py {posargs} + coverage erase + ostestr {posargs} + coverage combine + coverage report --omit='*tests*' + coverage html -d ./cover --omit='*tests*' [testenv:venv] commands = {posargs}