diff --git a/.gitignore b/.gitignore index 9a973420a9..c6112cd553 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,7 @@ keystone/tests/tmp/ .project .pydevproject keystone/locale/*/LC_MESSAGES/*.mo -.testrepository/ +.stestr/ *.db # Files created by releasenotes build releasenotes/build diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000000..c3f094000c --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,4 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-./keystone/tests/unit} +top_dir=./ +group_regex=.*(test_cert_setup) diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 20703b3589..0000000000 --- a/.testr.conf +++ /dev/null @@ -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} - diff --git a/HACKING.rst b/HACKING.rst index 40dc1142e1..5599c6988d 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -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 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/ diff --git a/test-requirements.txt b/test-requirements.txt index 88af2a02f1..3cbd752b6a 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -28,8 +28,7 @@ os-api-ref>=1.0.0 # Apache-2.0 # test wsgi apps without starting an http server WebTest>=2.0 # MIT -python-subunit>=0.0.18 # Apache-2.0/BSD -testrepository>=0.0.18 # Apache-2.0/BSD +stestr>=1.0.0 # Apache-2.0 testtools>=1.4.0 # MIT # For documentation diff --git a/tox.ini b/tox.ini index 5389144c28..84671f0976 100644 --- a/tox.ini +++ b/tox.ini @@ -45,9 +45,15 @@ commands = bandit -r keystone -x tests [testenv:cover] # Also do not run test_coverage_ext tests while gathering coverage as those # tests conflict with coverage. +setenv = + {[testenv]setenv} + PYTHON=coverage run --source keystone --parallel-mode commands = 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] commands =