From 9f143f124120659cedd921ea97605c1fba5b54c8 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 4 Apr 2018 21:52:34 +0100 Subject: [PATCH] Replace testr with stestr Switch to use stestr which is maintained as opposed to testrepository (testr) which became a defunct project. Change-Id: If53c985b6cf3b4122596f09ec4d0ec4a186688b8 --- .gitignore | 2 ++ .stestr.conf | 3 +++ .testr.conf | 4 ---- test-requirements.txt | 2 +- tox.ini | 19 ++++++++++++++++--- 5 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index cbd6ab9..3eb6a48 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ # Unit test / coverage reports cover/ + +/.stestr diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..f90b1f5 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=tests +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 5433c07..0000000 --- a/.testr.conf +++ /dev/null @@ -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 diff --git a/test-requirements.txt b/test-requirements.txt index 06dd44d..e3446fd 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,6 +6,6 @@ python-subunit requests-mock>=1.4.0 requests-kerberos sphinx>=1.2,<1.3.0 -testrepository +stestr>=2.0.0 testscenarios testtools diff --git a/tox.ini b/tox.ini index 637fc9f..2340526 100644 --- a/tox.ini +++ b/tox.ini @@ -4,14 +4,27 @@ skipsdist = True envlist = py{34,27,35}, pep8, pypy [testenv] -setenv VIRTUAL_ENV={envdir} +setenv = + PYTHONDONTWRITEBYTECODE=1 + VIRTUAL_ENV={envdir} usedevelop = True install_command = pip install {opts} {packages} 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] -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] commands = flake8