From e56801f2e8a04f08813125b05a4ff8c983beddbd Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Wed, 21 Mar 2018 07:49:15 -0700 Subject: [PATCH] Revert "Switch to stestr" There are several differences between this and testr which we need to discuss. Let's wait until after the v3 release so we don't delay it further. This reverts commit 68e02466ce13a5dbc01ada10b2704701544717dd. Change-Id: I873145c15fd88fe752cb987d0892c146c35041d8 --- .coveragerc | 7 ------- .stestr.conf | 3 --- .testr.conf | 4 ++++ TESTING.rst | 27 ++++++++++++++++----------- test-requirements.txt | 3 ++- tox.ini | 24 +++++++++--------------- 6 files changed, 31 insertions(+), 37 deletions(-) delete mode 100644 .coveragerc delete mode 100644 .stestr.conf create mode 100644 .testr.conf diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index b10a8654dd..0000000000 --- a/.coveragerc +++ /dev/null @@ -1,7 +0,0 @@ -[run] -branch = True -source = zuul -omit = tests/* - -[report] -ignore_errors = True diff --git a/.stestr.conf b/.stestr.conf deleted file mode 100644 index 2978dacaaa..0000000000 --- a/.stestr.conf +++ /dev/null @@ -1,3 +0,0 @@ -[DEFAULT] -test_path=tests/unit -top_dir=./ diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 0000000000..7e8d028994 --- /dev/null +++ b/.testr.conf @@ -0,0 +1,4 @@ +[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_LOG_DEFAULTS=${OS_LOG_DEFAULTS:-""} ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./tests/unit} $LISTOPT $IDOPTION +test_id_option=--load-list $IDFILE +test_list_option=--list diff --git a/TESTING.rst b/TESTING.rst index 24da82da9d..289af5c2bc 100644 --- a/TESTING.rst +++ b/TESTING.rst @@ -50,7 +50,6 @@ Run The Tests *Navigate to the project's root directory and execute*:: tox - Note: completing this command may take a long time (depends on system resources) also, you might not see any output until tox is complete. @@ -69,9 +68,9 @@ Tox will run your entire test suite in the environments specified in the project To run the test suite in just one of the environments in envlist execute:: tox -e -so for example, *run the test suite in py35*:: +so for example, *run the test suite in py26*:: - tox -e py35 + tox -e py26 Run One Test ------------ @@ -80,20 +79,20 @@ To run individual tests with tox:: tox -e -- path.to.module.Class.test -For example, to *run a single Zuul test*:: +For example, to *run the basic Zuul test*:: - tox -e py35 -- tests.unit.test_scheduler.TestScheduler.test_jobs_executed + tox -e py27 -- tests.unit.test_scheduler.TestScheduler.test_jobs_executed To *run one test in the foreground* (after previously having run tox to set up the virtualenv):: - .tox/py35/bin/stestr run -t tests.unit.test_scheduler.TestScheduler.test_jobs_executed + .tox/py27/bin/python -m testtools.run tests.unit.test_scheduler.TestScheduler.test_jobs_executed List Failing Tests ------------------ - .tox/py35/bin/activate - stestr failing --list + .tox/py27/bin/activate + testr failing --list Hanging Tests ------------- @@ -101,8 +100,8 @@ Hanging Tests The following will run each test in turn and print the name of the test as it is run:: - . .tox/py35/bin/activate - stestr run + . .tox/py27/bin/activate + testr run --subunit | subunit2pyunit You can compare the output of that to:: @@ -111,4 +110,10 @@ You can compare the output of that to:: Need More Info? --------------- -More information about stestr: http://stestr.readthedocs.io/en/latest/ +More information about testr: https://wiki.openstack.org/wiki/Testr + +More information about nose: https://nose.readthedocs.org/en/latest/ + + +More information about testing OpenStack code can be found here: +https://wiki.openstack.org/wiki/Testing diff --git a/test-requirements.txt b/test-requirements.txt index 98880cd778..ae033094d2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,8 @@ coverage>=3.6 sphinx>=1.5.1,<1.6 sphinxcontrib-blockdiag>=1.1.0 fixtures>=0.3.14 -stestr>=1.0.0 # Apache-2.0 +python-subunit +testrepository>=0.0.17 testtools>=0.9.32 sphinxcontrib-programoutput sphinx-autodoc-typehints diff --git a/tox.ini b/tox.ini index 24a78c27a2..4968469903 100644 --- a/tox.ini +++ b/tox.ini @@ -7,17 +7,13 @@ envlist = pep8,py35 basepython = python3 setenv = VIRTUAL_ENV={envdir} OS_TEST_TIMEOUT=150 - OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:1} - OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:1} - OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:1} - OS_LOG_DEFAULTS={env:OS_LOG_DEFAULTS:""} passenv = ZUUL_TEST_ROOT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE OS_LOG_DEFAULTS usedevelop = True install_command = pip install {opts} {packages} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = stestr run {posargs} - stestr slowest +commands = + python setup.py test --slowest --testr-args='{posargs}' [testenv:bindep] # Do not install any requirements. We want this to be fast and work even if @@ -36,14 +32,8 @@ commands = mypy --ignore-missing-imports zuul [testenv:cover] -setenv = - {[testenv]setenv} - PYTHON=coverage run --source zuul --parallel-mode commands = - stestr run {posargs} - coverage combine - coverage html -d cover - coverage xml -o cover/coverage.xml + python setup.py test --coverage [testenv:docs] commands = @@ -53,11 +43,15 @@ commands = commands = {posargs} [testenv:nodepool] -commands = stestr run --concurrency=1 --test-path ./tests/nodepool {posargs} +setenv = + OS_TEST_PATH = ./tests/nodepool +commands = python setup.py test --slowest --testr-args='--concurrency=1 {posargs}' [testenv:remote] -commands = stestr run --concurrency=1 --test-path ./tests/remote {posargs} +setenv = + OS_TEST_PATH = ./tests/remote passenv = ZUUL_TEST_ROOT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE OS_LOG_DEFAULTS ZUUL_REMOTE_IPV4 ZUUL_SSH_KEY NODEPOOL_ZK_HOST +commands = python setup.py test --slowest --testr-args='--concurrency=1 {posargs}' [flake8] # These are ignored intentionally in openstack-infra projects;