Migrate to stestr

With the latests changes to os-testr[0] it now expects
a .stestr.conf file instead of a .testr.conf file. This
change migrates the testing suite from using testr to
use stestr instead.

[0] http://lists.openstack.org/pipermail/openstack-dev/2017-September/122135.html

Change-Id: Ie0de862f2192491fa7752af03c8c03b3ee36337a
This commit is contained in:
Gage Hugo 2017-09-15 10:50:56 -05:00
parent 30eb190995
commit 71e543152e
6 changed files with 22 additions and 20 deletions

2
.gitignore vendored
View File

@ -30,7 +30,7 @@ keystone/tests/tmp/
.project .project
.pydevproject .pydevproject
keystone/locale/*/LC_MESSAGES/*.mo keystone/locale/*/LC_MESSAGES/*.mo
.testrepository/ .stestr/
*.db *.db
# Files created by releasenotes build # Files created by releasenotes build
releasenotes/build releasenotes/build

4
.stestr.conf Normal file
View File

@ -0,0 +1,4 @@
[DEFAULT]
test_path=${OS_TEST_PATH:-./keystone/tests/unit}
top_dir=./
group_regex=.*(test_cert_setup)

View File

@ -1,16 +0,0 @@
[DEFAULT]
test_command=
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./keystone/tests/unit} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list
group_regex=.*(test_cert_setup)
# NOTE(morganfainberg): If single-worker mode is wanted (e.g. for live tests)
# the environment variable ``TEST_RUN_CONCURRENCY`` should be set to ``1``. If
# a non-default (1 worker per available core) concurrency is desired, set
# environment variable ``TEST_RUN_CONCURRENCY`` to the desired number of
# workers.
test_run_concurrency=echo ${TEST_RUN_CONCURRENCY:-0}

View File

@ -56,3 +56,12 @@ callable we prefer that the call also uses keyword arg syntax. For example::
This gives us the flexibility to re-order arguments and more importantly This gives us the flexibility to re-order arguments and more importantly
to add new required arguments. It's also more explicit and easier to read. to add new required arguments. It's also more explicit and easier to read.
Testing
-------
keystone uses testtools and stestr for its unittest suite and its test
runner. If you'd like to learn more in depth:
https://testtools.readthedocs.io/en/latest/
https://stestr.readthedocs.io/en/latest/

View File

@ -28,8 +28,7 @@ os-api-ref>=1.0.0 # Apache-2.0
# test wsgi apps without starting an http server # test wsgi apps without starting an http server
WebTest>=2.0 # MIT WebTest>=2.0 # MIT
python-subunit>=0.0.18 # Apache-2.0/BSD stestr>=1.0.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
testtools>=1.4.0 # MIT testtools>=1.4.0 # MIT
# For documentation # For documentation

View File

@ -45,9 +45,15 @@ commands = bandit -r keystone -x tests
[testenv:cover] [testenv:cover]
# Also do not run test_coverage_ext tests while gathering coverage as those # Also do not run test_coverage_ext tests while gathering coverage as those
# tests conflict with coverage. # tests conflict with coverage.
setenv =
{[testenv]setenv}
PYTHON=coverage run --source keystone --parallel-mode
commands = commands =
find keystone -type f -name "*.pyc" -delete find keystone -type f -name "*.pyc" -delete
python setup.py testr --coverage --testr-args='{posargs}' stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:patch_cover] [testenv:patch_cover]
commands = commands =