From c5cd8d5a481aaadb4ce4ad16d425ec01e629fbd2 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 31 Aug 2018 12:31:39 +0000 Subject: [PATCH] Switch tox env to stestr & add .gitreview file This commit switch tox env to stestr and fix few tests. Add the file that tells git-review where the gerrit instance is. Change-Id: I717c02e790d5bd22991cc6898e0b3654e083617c Signed-off-by: Doug Hellmann Co-author: ghanshyam --- .gitignore | 1 + .gitreview | 4 ++++ .stestr.conf | 3 +++ tempest_stress/driver.py | 2 +- tempest_stress/tests/stress/test_stress.py | 3 ++- test-requirements.txt | 1 + tox.ini | 14 ++++++++++++-- 7 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 .gitreview create mode 100644 .stestr.conf diff --git a/.gitignore b/.gitignore index 008ce4d..98b3902 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ htmlcov/ .coverage .coverage.* .cache +.stestr nosetests.xml coverage.xml *,cover diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..d0ee5d5 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack/tempest-stress.git diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..d338fee --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./tempest_stress/tests +top_dir=./ diff --git a/tempest_stress/driver.py b/tempest_stress/driver.py index 5a82fb1..b389cfb 100644 --- a/tempest_stress/driver.py +++ b/tempest_stress/driver.py @@ -21,11 +21,11 @@ from oslo_log import log as logging from oslo_utils import importutils import six from tempest import clients -from tempest.common import cred_client from tempest.common import credentials_factory as credentials from tempest.common.utils import data_utils from tempest import config from tempest import exceptions +from tempest.lib.common import cred_client from tempest.lib.common import ssh from tempest_stress import cleanup diff --git a/tempest_stress/tests/stress/test_stress.py b/tempest_stress/tests/stress/test_stress.py index 918e8af..8f24e3e 100644 --- a/tempest_stress/tests/stress/test_stress.py +++ b/tempest_stress/tests/stress/test_stress.py @@ -44,7 +44,8 @@ class StressFrameworkTest(base.TestCase): LOG.debug('error of %s:\n%s' % (cmd_str, result_err)) raise exceptions.CommandFailed(proc.returncode, cmd, - result) + result, + result_err) finally: LOG.debug('output of %s:\n%s' % (cmd_str, result)) return proc.returncode diff --git a/test-requirements.txt b/test-requirements.txt index 86c11d0..496f5a4 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,6 +5,7 @@ hacking<0.12,>=0.11.0 # Apache-2.0 coverage>=3.6 # Apache-2.0 +stestr>=1.0.0 # Apache-2.0 python-subunit>=0.0.18 # Apache-2.0/BSD sphinx!=1.3b1,<1.3,>=1.2.1 # BSD oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 9bccea1..7a07855 100644 --- a/tox.ini +++ b/tox.ini @@ -8,8 +8,11 @@ usedevelop = True setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning + OS_STDOUT_CAPTURE=1 + OS_STDERR_CAPTURE=1 + OS_TEST_TIMEOUT=60 deps = -r{toxinidir}/test-requirements.txt -commands = python setup.py test --slowest --testr-args='{posargs}' +commands = stestr --test-path ./tempest_stress/tests run {posargs} [testenv:stress] envdir = .tox/tempest_stress @@ -25,7 +28,14 @@ commands = flake8 {posargs} commands = {posargs} [testenv:cover] -commands = python setup.py test --coverage --testr-args='{posargs}' +setenv = + VIRTUAL_ENV={envdir} + PYTHON=coverage run --source tempest_stress --parallel-mode +commands = + stestr --test-path ./tempest_stress/tests run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:docs] commands = python setup.py build_sphinx