From ce744c83eb253db8373d864e8165938f4fed2b76 Mon Sep 17 00:00:00 2001 From: Sean Mooney Date: Fri, 20 Jul 2018 00:57:20 +0100 Subject: [PATCH] modernize testing - This change adds constratins support - This change removes pretty_tox which failed on python 3 in favor of stestr - This change adds py36 - This change removes the broken cover env - This change adds libvirt-python as a test requirement - This change adds a reno stub for confromance to the PTI. Change-Id: I116566c317b360ea325a06a8fbd11e29688cf602 --- .gitignore | 1 + .stestr.conf | 3 +++ .../notes/adopt-PTI-b43d31b7b6ef3410.yaml | 8 +++++++ test-requirements.txt | 4 +++- tools/pretty_tox.sh | 7 ------ tox.ini | 24 +++++++++++-------- 6 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 .stestr.conf create mode 100644 releasenotes/notes/adopt-PTI-b43d31b7b6ef3410.yaml delete mode 100644 tools/pretty_tox.sh diff --git a/.gitignore b/.gitignore index 7f98595..b7df282 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ pip-log.txt nosetests.xml .testrepository .venv +.stestr # Translations *.mo diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..88843b9 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-.} +top_dir=./ diff --git a/releasenotes/notes/adopt-PTI-b43d31b7b6ef3410.yaml b/releasenotes/notes/adopt-PTI-b43d31b7b6ef3410.yaml new file mode 100644 index 0000000..f6e8605 --- /dev/null +++ b/releasenotes/notes/adopt-PTI-b43d31b7b6ef3410.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + In the rocky cycle, several changes were made to the testing structure of + the collectd-openstack-plugins repo to conform to the new python testing + interface (PTI). Use of upper constraints was introduced, stestr was + adopted as the default test runner and sphinx-build became the default + docs building command. diff --git a/test-requirements.txt b/test-requirements.txt index 0697441..3934971 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,11 +11,13 @@ oslosphinx>=2.5.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 os-testr testrepository>=0.0.18 -pylint +pylint; python_version!='2.7' python-subunit>=0.0.18 sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 testscenarios>=0.4 testtools>=1.4.0 +libvirt-python +stestr>=1.0.0 # Apache-2.0 # releasenotes reno>=1.6.2 # Apache2 diff --git a/tools/pretty_tox.sh b/tools/pretty_tox.sh deleted file mode 100644 index a185c51..0000000 --- a/tools/pretty_tox.sh +++ /dev/null @@ -1,7 +0,0 @@ -#! /bin/sh - -TESTRARGS=$1 - -exec 3>&1 -status=$(exec 4>&1 >&3; ( python setup.py testr --slowest --testr-args="--subunit $TESTRARGS"; echo $? >&4 ) | subunit-trace -f) && exit $status - diff --git a/tox.ini b/tox.ini index fbf9475..d8e95b3 100644 --- a/tox.ini +++ b/tox.ini @@ -5,17 +5,21 @@ [tox] minversion = 1.6 -envlist = py35,py27,pep8 +envlist = py{36,35,27},pep8,docs,releasenotes skipsdist = True [testenv] usedevelop = True -install_command = pip install -r requirements.txt -U {opts} {packages} -commands = sh tools/pretty_tox.sh '{posargs}' -deps = -r{toxinidir}/test-requirements.txt -whitelist_externals = sh setenv = VIRTUAL_ENV={envdir} + CONSTRAINTS_OPT=-c {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} + +install_command = pip install -U {opts} {packages} +commands = stestr run --slowest '{posargs}' +deps = {env:CONSTRAINTS_OPT} + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +whitelist_externals = sh [testenv:pep8] commands = flake8 collectd_openstack @@ -23,15 +27,15 @@ commands = flake8 collectd_openstack [testenv:venv] commands = {posargs} -[testenv:cover] -commands = python setup.py test --coverage - [testenv:docs] -commands = python setup.py build_sphinx +#fixeme(sean-k-mooney): add -W to treat warnings as errors once warnings are fixed +commands = sphinx-build doc/source doc/build [testenv:releasenotes] +#fixeme(sean-k-mooney): add -W to treat warnings as errors once warnings are fixed +#NOTE(sean-k-mooney): our releasenotes crash sphinx so we should really fix them ... commands = - sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html + sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [pep8] max-line-length = 80