From 0c71102f0e38a6b2f1bd06e8a8029bf13427fe27 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Tue, 23 Jan 2018 09:11:27 -0600 Subject: [PATCH] Switch to stestr stestr is maintained, while testrepository is not. OpenStack is migrating to stestr, go ahead and follow suit. The --no-subunit-trace flag is added to keep the quiet test run behavior. If we remove it, stestr will by default print the name of each test as it starts it. This uses environment inclusions which need tox 2.8.1 due to a bug fix. So increase the tox minversion. Change-Id: I08cd4bee86b56d9a68644b049497c34e34e5f226 --- .coveragerc | 7 +++++++ .stestr.conf | 3 +++ .testr.conf | 4 ---- test-requirements.txt | 2 +- tox.ini | 17 +++++++++++++---- 5 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 .coveragerc create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000..1e552e522 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,7 @@ +[run] +branch = True +source = nodepool +omit = nodepool/tests/* + +[report] +ignore_errors = True diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..cef09df62 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=nodepool/tests +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 817745d4c..000000000 --- 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_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ nodepool/tests/ $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/test-requirements.txt b/test-requirements.txt index 5a357a2b3..81b770854 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,6 +8,6 @@ reno>=2.5.0 # Apache-2.0 fixtures>=0.3.12 mock>=1.0 python-subunit -testrepository>=0.0.13 +stestr>=1.0.0 # Apache-2.0 testscenarios testtools>=0.9.27 diff --git a/tox.ini b/tox.ini index 6638ca5a2..1c422cfc2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -minversion = 1.6 +minversion = 2.8.1 skipsdist = True envlist = pep8,py35 @@ -8,13 +8,16 @@ envlist = pep8,py35 setenv = STATSD_HOST=localhost STATSD_PORT=8125 VIRTUAL_ENV={envdir} + OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true} + OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true} + OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true} usedevelop = True install_command = pip install {opts} {packages} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt passenv = NODEPOOL_ZK_HOST -commands = - python setup.py testr --slowest --testr-args='{posargs}' +commands = stestr run --no-subunit-trace {posargs} + stestr slowest [testenv:pep8] basepython = python3 @@ -30,8 +33,14 @@ commands = bindep test [testenv:cover] basepython = python3 +setenv = + {[testenv]setenv} + PYTHON=coverage run --source nodepool --parallel-mode commands = - python setup.py testr --coverage + stestr run --no-subunit-trace {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:docs] basepython = python3