From 7c62d3b53d73c2a51e08afff284f190687073ab4 Mon Sep 17 00:00:00 2001 From: HeroicHitesh Date: Mon, 17 May 2021 18:11:36 +0530 Subject: [PATCH] Migrate from testr to stestr * Replace .testr.conf by .stestr.conf for migration and update .gitignore, test-requirements.txt and lower-constraints.txt files accordingly * Use py3 as the default runtime for tox and 3.18.0 as the minversion for tox * Add a new job, openstack-cover-jobs, to run the coverage in Zuul * Create cover environment in tox and make relevant changes in .gitignore Signed-off-by: HeroicHitesh Change-Id: I3de659cdda2f490590dbfb38c81b95becac5da7c --- .gitignore | 21 +++++++++++++++++---- .stestr.conf | 3 +++ .testr.conf | 4 ---- .zuul.yaml | 1 + lower-constraints.txt | 2 +- test-requirements.txt | 2 +- tox.ini | 23 ++++++++++++++++++----- 7 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 5072799..de1e0a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,24 @@ *.pyc -*.swp -*~ -.tox -.testrepository + +# Packages +*.egg* +*.egg-info build + +# Unit test / coverage reports +cover/ +.coverage* +!.coveragerc +.tox +.stestr/ + +# pbr generates these AUTHORS ChangeLog +# Editors +*.swp +*~ + # Files created by releasenotes build releasenotes/build diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..c2c8a3a --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./tests/ +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index a2ff14b..0000000 --- a/.testr.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=${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 0ab0e81..c954bb0 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -5,3 +5,4 @@ - publish-openstack-docs-pti - release-notes-jobs-python3 - openstack-lower-constraints-jobs + - openstack-cover-jobs diff --git a/lower-constraints.txt b/lower-constraints.txt index 77e786a..0d16428 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -66,7 +66,7 @@ salt==3001.1 simplejson==3.5.1 six==1.10.0 stevedore==1.20.0 -testrepository==0.0.18 +stestr==2.0.0 testscenarios==0.4 testtools==2.2.0 tornado==4.4.3 diff --git a/test-requirements.txt b/test-requirements.txt index d142ba7..da4a623 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,7 +8,7 @@ hacking>=3.0.1,<3.1.0 # Apache-2.0 requests>=2.14.2 # Apache-2.0 requests-mock>=1.1.0 # Apache-2.0 salt>=3001.1 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD +stestr>=2.0.0 # Apache-2.0 testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT os-apply-config>=5.0.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index b7b67d8..35fdf5f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,18 +1,17 @@ [tox] -envlist = py38,pep8 +envlist = py3,pep8 ignore_basepython_conflict = true -minversion = 3.1.0 +minversion = 3.18.0 skipsdist = True [testenv] basepython = python3 -whitelist_externals = bash +allowlist_externals = bash setenv = VIRTUAL_ENV={envdir} deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi' - testr run {posargs} +commands= stestr run --slowest {posargs} [testenv:pep8] commands = flake8 @@ -31,6 +30,20 @@ show-source = True builtins = _ exclude=.venv,.git,.tox,*lib/python*,private,.eggs +[testenv:cover] +basepython = python3 +allowlist_externals = find +setenv = + PYTHON=coverage run --source . --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:releasenotes] deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}