Replace testr with stestr

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

Change-Id: If53c985b6cf3b4122596f09ec4d0ec4a186688b8
This commit is contained in:
Sorin Sbarnea 2018-04-04 21:52:34 +01:00
parent c902397b29
commit 9f143f1241
5 changed files with 22 additions and 8 deletions

2
.gitignore vendored
View File

@ -17,3 +17,5 @@
# Unit test / coverage reports # Unit test / coverage reports
cover/ cover/
/.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

@ -6,6 +6,6 @@ python-subunit
requests-mock>=1.4.0 requests-mock>=1.4.0
requests-kerberos requests-kerberos
sphinx>=1.2,<1.3.0 sphinx>=1.2,<1.3.0
testrepository stestr>=2.0.0
testscenarios testscenarios
testtools testtools

19
tox.ini
View File

@ -4,14 +4,27 @@ skipsdist = True
envlist = py{34,27,35}, pep8, pypy envlist = py{34,27,35}, pep8, pypy
[testenv] [testenv]
setenv VIRTUAL_ENV={envdir} setenv =
PYTHONDONTWRITEBYTECODE=1
VIRTUAL_ENV={envdir}
usedevelop = True usedevelop = True
install_command = pip install {opts} {packages} install_command = pip install {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}' commands =
- find . -type f -name "*.pyc" -delete
- find . -type d -name "__pycache__" -delete
stestr run --slowest {posargs}
whitelist_externals = find
[testenv:cover] [testenv:cover]
commands = python setup.py test --coverage --testr-args='{posargs}' setenv =
{[testenv]setenv}
PYTHON=coverage run --source jenkins --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:pep8] [testenv:pep8]
commands = flake8 commands = flake8