Replace testr with stestr

Switch to use stestr which is maintained as opposed
to testrepository (testr) which became a defunct project.

Change-Id: I47f628a7d224189362f2b2cfd9fe4c54af198cde
This commit is contained in:
Sorin Sbarnea 2018-04-04 21:57:33 +01:00
parent 3b120c3bab
commit c8ba7a5a0f
5 changed files with 15 additions and 11 deletions

1
.gitignore vendored
View File

@ -21,3 +21,4 @@ cover/
jenkins-job-builder jenkins-job-builder
testr_subunit_log testr_subunit_log
__pycache__ __pycache__
/.stestr

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=tests
top_dir=./

View File

@ -1,4 +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} ${PYTHON:-python} -m subunit.run discover -t ./ tests $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -9,7 +9,7 @@ python-subunit>=0.0.18 # Apache-2.0/BSD
sphinx>=1.5.0,<1.7.0 sphinx>=1.5.0,<1.7.0
testscenarios>=0.4 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD
testtools>=1.4.0 # MIT testtools>=1.4.0 # MIT
testrepository>=0.0.18 # Apache-2.0/BSD stestr>=2.0.0 # Apache-2.0/BSD
tox>=2.9.1 # MIT tox>=2.9.1 # MIT
mock>=2.0 # BSD mock>=2.0 # BSD
sphinxcontrib-programoutput sphinxcontrib-programoutput

14
tox.ini
View File

@ -20,7 +20,7 @@ deps = -r{toxinidir}/test-requirements.txt
commands = commands =
- find . -type f -name "*.pyc" -delete - find . -type f -name "*.pyc" -delete
- find . -type d -name "__pycache__" -delete - find . -type d -name "__pycache__" -delete
python setup.py testr --slowest --testr-args='{posargs}' stestr run --slowest {posargs}
whitelist_externals = whitelist_externals =
bash bash
find find
@ -28,17 +28,21 @@ whitelist_externals =
[testenv:tips] [testenv:tips]
# tests what happens with unreleased version of dependencies, like python-jenkins # tests what happens with unreleased version of dependencies, like python-jenkins
install_command = pip install -U {opts} {packages} install_command = pip install -U {opts} {packages}
ignore_outcome = true
commands = commands =
bash -c "if [ -d {toxinidir}/../python-jenkins ]; then \ bash -c "if [ -d {toxinidir}/../python-jenkins ]; then \
pip install -q -U -e 'git+file://{toxinidir}/../python-jenkins#egg=python-jenkins' ; else \ pip install -q -U -e 'git+file://{toxinidir}/../python-jenkins#egg=python-jenkins' ; else \
pip install -q -U -e 'git+https://git.openstack.org/openstack/python-jenkins@master#egg=python-jenkins' ; fi " pip install -q -U -e 'git+https://git.openstack.org/openstack/python-jenkins@master#egg=python-jenkins' ; fi "
python setup.py testr --slowest --testr-args='{posargs}' stestr run --slowest {posargs}
[testenv:cover] [testenv:cover]
setenv =
{[testenv]setenv}
PYTHON=coverage run --source jenkins_jobs --parallel-mode
commands = commands =
python setup.py test --coverage --coverage-package-name=jenkins_jobs stestr run {posargs}
coverage report coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:pep8] [testenv:pep8]
commands = flake8 commands = flake8