From 0ef540fc20e6c6403f098edcebd0bc39b59b9935 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Mon, 25 Sep 2017 14:00:05 -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: I2c1b271550629437627f3f62b6f33e2beb2b3c4b --- .gitignore | 1 + .stestr.conf | 3 +++ .testr.conf | 4 ---- tox.ini | 7 ++++++- 4 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 77537cfd1..c261345cf 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ devenv/* cover .coverage coverage.xml +.stestr .testrepository imagebuild/.image_cache imagebuild/coreos/build diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..39760b3b6 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-./ironic_python_agent/tests/unit} +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 55eaef199..000000000 --- a/.testr.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./ironic_python_agent/tests} $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/tox.ini b/tox.ini index d0f6e1a21..65678b7e8 100644 --- a/tox.ini +++ b/tox.ini @@ -36,8 +36,13 @@ commands = [testenv:cover] setenv = VIRTUAL_ENV={envdir} + PYTHON=coverage run --source ironic_python_agent --omit='*tests*' --parallel-mode commands = - python setup.py test --coverage --coverage-package-name ironic_python_agent {posargs} + coverage erase + ostestr {posargs} + coverage combine + coverage report --omit='*tests*' + coverage html -d ./cover --omit='*tests*' [testenv:venv] setenv = PYTHONHASHSEED=0