From 524821fa31fb048aa0133e3baf0f20d2a5470d3f Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Fri, 10 Aug 2018 14:04:40 +0200 Subject: [PATCH] Switch to stestr According to OpenStack summit session [1], stestr is maintained project to which all OpenStack projects should migrate. Let's switch to stestr as other projects have already moved to it. Uses environment inclusions which need tox 2.8.1 due to a bug fix. So increase the tox minversion. [1] https://etherpad.openstack.org/p/YVR-python-pti Change-Id: If6eded0dd802cbdfe49ad72c64004585d4a1484b --- .coveragerc | 7 +++++++ .stestr.conf | 3 +++ .testr.conf | 8 -------- lower-constraints.txt | 3 +-- requirements.txt | 2 +- test-requirements.txt | 3 +-- tox.ini | 16 +++++++++++++--- 7 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 .coveragerc create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..1edec714 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,7 @@ +[run] +branch = True +source = pyghmi +omit = pyghmi/tests/* + +[report] +ignore_errors = True diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 00000000..ca7bb87a --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${TESTS_DIR:-./pyghmi/tests/unit/} +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 748029b4..00000000 --- a/.testr.conf +++ /dev/null @@ -1,8 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION - -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/lower-constraints.txt b/lower-constraints.txt index 85549d7f..976a730b 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -2,9 +2,8 @@ coverage===4.0 cryptography===2.1 fixtures===3.0.0 oslotest===3.2.0 -os-testr===1.0.0 python-subunit===1.0.0 Sphinx===1.6.5 -testrepository===0.0.18 +stestr==1.0.0 testscenarios===0.4 testtools===2.2.0 diff --git a/requirements.txt b/requirements.txt index c010a524..1fb58a99 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -cryptography!=2.0 # BSD/Apache-2.0 +cryptography>=2.1 # BSD/Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index 02b01178..24ea8264 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,8 +3,7 @@ coverage>=4.0 fixtures>=3.0.0 python-subunit>=1.0.0 sphinx>=1.6.5 -testrepository>=0.0.18 +stestr>=1.0.0 # Apache-2.0 testscenarios>=0.4 testtools>=2.2.0 -os-testr>=1.0.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index fc4f75ec..f49d9816 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,5 @@ [tox] +minversion = 2.8.1 envlist = py35,py27,pep8 [testenv] @@ -7,9 +8,13 @@ setenv = VIRTUAL_ENV={envdir} LANGUAGE=en_US:en LC_ALL=C TESTS_DIR=./pyghmi/tests/unit/ + OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true} + OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true} + OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = ostestr {posargs} +commands = stestr run {posargs} + stestr slowest [tox:jenkins] sitepackages = True @@ -21,9 +26,14 @@ commands = bash -c 'pycodestyle pyghmi bin/*' [testenv:cover] basepython = python3 -setenv = VIRTUAL_ENV={envdir} +setenv = + {[testenv]setenv} + PYTHON=coverage run --source pyghmi --parallel-mode commands = - python setup.py testr --coverage + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:venv] basepython = python3