From b1dfb53ba1071760453c9d621d21b3c99fbccfa8 Mon Sep 17 00:00:00 2001 From: Jim Rollenhagen Date: Tue, 15 Dec 2015 05:43:32 -0800 Subject: [PATCH] Switch tox unit test command to use ostestr Blatantly plagiarized from I1acc2deadc01421baec256352b35a646676445e5 This commit switches the tox command to use ostestr instead of calling testr through setup.py. The primary advantage here is that it uses the subunit-trace output filter. ostestr primarily exists as a replacement for pretty_tox.sh bash scripts which spread like a plague through OpenStack projects after Nova copied it from Tempest. (although ostestr also provides some other useful features) Granted ironic wasn't using that, but this commit makes the switch to enable getting the subunit-trace output which is generally useful. Note that this dramatically increases output while running tests. However, test failures are still at the bottom of the output, so it shouldn't cause much pain, if any. Change-Id: Ia373b9b4857824644e99a2c8d27e64018cb84b78 --- .testr.conf | 2 +- test-requirements.txt | 2 +- tox.ini | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.testr.conf b/.testr.conf index 80269e12b..984a59737 100644 --- a/.testr.conf +++ b/.testr.conf @@ -1,5 +1,5 @@ [DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./ironicclient/tests/unit} $LISTOPT $IDOPTION +test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} ${PYTHON:-python} -m subunit.run discover -t ./ ${TESTS_DIR:-./ironicclient/tests/unit} $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list diff --git a/test-requirements.txt b/test-requirements.txt index 97b9fe598..36863c791 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -13,6 +13,6 @@ oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 python-subunit>=0.0.18 sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 -testrepository>=0.0.18 testtools>=1.4.0 tempest-lib>=0.11.0 +os-testr>=0.4.1 diff --git a/tox.ini b/tox.ini index a83031d22..f24701a3c 100644 --- a/tox.ini +++ b/tox.ini @@ -6,13 +6,15 @@ skipsdist = True [testenv] setenv = VIRTUAL_ENV={envdir} LANGUAGE=en_US + # .testr.conf uses TESTS_DIR + TESTS_DIR=./ironicclient/tests/unit usedevelop = True install_command = pip install -U {opts} {packages} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = - python setup.py testr --slowest --testr-args='{posargs}' + ostestr {posargs} [testenv:pep8] commands = @@ -29,7 +31,7 @@ commands = commands = {posargs} [testenv:functional] -setenv = OS_TEST_PATH=./ironicclient/tests/functional +setenv = TESTS_DIR=./ironicclient/tests/functional LANGUAGE=en_US [flake8]