From 896d04e8425f6420d63d42c8340b26c3ad067bcb Mon Sep 17 00:00:00 2001 From: HeroicHitesh Date: Thu, 29 Apr 2021 18:39:22 +0530 Subject: [PATCH] Migrate from testr to stestr * Replace .testr.conf by .stestr.conf for migration and update .gitignore and test-requirements.txt file accordingly * Use py3 as the default runtime for tox * Add a new job, openstack-cover-jobs, to run the coverage in Zuul Signed-off-by: HeroicHitesh Change-Id: I72eebd8adfa2086b7d3a11eedbfe2e69cfd65bcc --- .gitignore | 2 +- .stestr.conf | 3 +++ .testr.conf | 7 ------- .zuul.yaml | 1 + test-requirements.txt | 2 +- tox.ini | 18 +++++++++++++++--- 6 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 963e589..93e430d 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,7 @@ cover/ !.coveragerc .tox nosetests.xml -.testrepository +.stestr/ .venv # Translations diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..a2d268c --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./devstack/tests/ +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 6d83b3c..0000000 --- a/.testr.conf +++ /dev/null @@ -1,7 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/.zuul.yaml b/.zuul.yaml index 718c629..f28fe91 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -2,3 +2,4 @@ templates: - openstack-python3-xena-jobs - publish-openstack-docs-pti + - openstack-cover-jobs diff --git a/test-requirements.txt b/test-requirements.txt index fa22018..efde777 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,5 +8,5 @@ coverage>=4.0 # Apache-2.0 python-subunit>=0.0.18 # Apache-2.0/BSD fixtures oslotest>=1.10.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD +stestr>=2.0.0 # Apache-2.0 testtools>=1.4.0 # MIT diff --git a/tox.ini b/tox.ini index c5de120..8cb238c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 3.18.0 -envlist = py36,py38,pep8 +envlist = py3,pep8 skipsdist = True ignore_basepython_conflict = True @@ -13,7 +13,7 @@ setenv = deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/test-requirements.txt -commands = python setup.py test --slowest --testr-args='{posargs}' +commands = stestr run --slowest {posargs} [testenv:pep8] commands = flake8 {posargs} @@ -22,7 +22,19 @@ commands = flake8 {posargs} commands = {posargs} [testenv:cover] -commands = python setup.py test --coverage --testr-args='{posargs}' +basepython = python3 +allowlist_externals = find +setenv = + {[testenv]setenv} + PYTHON=coverage run --source devstack --parallel-mode +commands = + coverage erase + find . -type f -name "*.pyc" -delete + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + coverage report [testenv:docs] deps =