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 and 3.18.0 as the minversion
  for tox
* Add group_regex to run all tests

Signed-off-by: HeroicHitesh <email.hiteshkumar@gmail.com>
Change-Id: I704356082e2c25d21aff3c5433efa077259b0b1d
This commit is contained in:
HeroicHitesh 2021-05-03 16:44:41 +05:30
parent 280d9232c6
commit 687a3127d3
6 changed files with 46 additions and 37 deletions

41
.gitignore vendored
View File

@ -1,17 +1,5 @@
.coverage
coverage.xml
cover/*
doc/source/developer/api/
*~
.testrepository
*.sw?
#*#
*.pyc
.tox
*.egg
*.egg-info
*.eggs
dist
*.qcow2
*.raw
*.initrd
@ -19,9 +7,30 @@ dist
/*-manifests
/*.d
!/.zuul.d
build
AUTHORS
ChangeLog
bin/diskimage_builder
*.bak
*.orig
# Packages
*.egg*
*.egg-info
dist
build
eggs
bin/diskimage_builder
# Unit test / coverage reports
cover/
.coverage*
coverage.xml
!.coveragerc
.tox
.stestr/
.venv
# pbr generates these
AUTHORS
ChangeLog
# Editors
*~
*.sw?

4
.stestr.conf Normal file
View File

@ -0,0 +1,4 @@
[DEFAULT]
test_path=./diskimage_builder/
group_regex=diskimage_builder.(tests|elements|block_device)
top_dir=./

View File

@ -1,10 +0,0 @@
[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_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
OS_DEBUG=${OS_DEBUG:-1} \
${PYTHON:-python} -m subunit.run discover . $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -39,7 +39,7 @@ snowballstemmer==1.2.1
Sphinx==1.6.2
sphinxcontrib-websupport==1.0.1
stevedore==1.20.0
testrepository==0.0.18
stestr==2.0.0
testtools==2.2.0
traceback2==1.4.0
unittest2==1.1.0

View File

@ -7,7 +7,7 @@ pylint>=1.7.1 #GPLv2
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
oslotest>=3.2.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
stestr>=2.0.0 # Apache-2.0
testtools>=2.2.0 # MIT
coverage!=4.4,>=4.0 # Apache-2.0

24
tox.ini
View File

@ -1,6 +1,6 @@
[tox]
envlist = pep8,pylint,py35,py36,py37,py38
minversion = 3.2.1
envlist = pep8,pylint,py3
minversion = 3.18.0
skipsdist = True
ignore_basepython_conflict = True
@ -11,8 +11,7 @@ deps=
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands=
python setup.py test --slowest --testr-args='{posargs}'
commands= stestr run --slowest {posargs}
passenv=
DUMP_CONFIG_GRAPH
@ -36,11 +35,18 @@ envdir = {toxworkdir}/venv
commands = {toxinidir}/tests/run_functests.sh {posargs}
[testenv:cover]
# NOTE: this is "setup.py test" (*not* testr) which is a pbr wrapper
# around testr. This understands --coverage-package-name which we
# need due to underscore issues.
basepython = python3
commands = python setup.py test --coverage --coverage-package-name diskimage_builder --testr-args='{posargs}'
allowlist_externals = find
setenv =
PYTHON=coverage run --source diskimage_builder --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=
@ -48,7 +54,7 @@ deps=
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
basepython = python3
whitelist_externals =
allowlist_externals =
rm
commands =
rm -rf doc/build