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
This commit is contained in:
Sean Mooney 2018-07-20 00:57:20 +01:00
parent c6071ebcbd
commit ce744c83eb
6 changed files with 29 additions and 18 deletions

1
.gitignore vendored
View File

@ -31,6 +31,7 @@ pip-log.txt
nosetests.xml nosetests.xml
.testrepository .testrepository
.venv .venv
.stestr
# Translations # Translations
*.mo *.mo

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=${OS_TEST_PATH:-.}
top_dir=./

View File

@ -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.

View File

@ -11,11 +11,13 @@ oslosphinx>=2.5.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0
os-testr os-testr
testrepository>=0.0.18 testrepository>=0.0.18
pylint pylint; python_version!='2.7'
python-subunit>=0.0.18 python-subunit>=0.0.18
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
testscenarios>=0.4 testscenarios>=0.4
testtools>=1.4.0 testtools>=1.4.0
libvirt-python
stestr>=1.0.0 # Apache-2.0
# releasenotes # releasenotes
reno>=1.6.2 # Apache2 reno>=1.6.2 # Apache2

View File

@ -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

24
tox.ini
View File

@ -5,17 +5,21 @@
[tox] [tox]
minversion = 1.6 minversion = 1.6
envlist = py35,py27,pep8 envlist = py{36,35,27},pep8,docs,releasenotes
skipsdist = True skipsdist = True
[testenv] [testenv]
usedevelop = True 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 = setenv =
VIRTUAL_ENV={envdir} 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] [testenv:pep8]
commands = flake8 collectd_openstack commands = flake8 collectd_openstack
@ -23,15 +27,15 @@ commands = flake8 collectd_openstack
[testenv:venv] [testenv:venv]
commands = {posargs} commands = {posargs}
[testenv:cover]
commands = python setup.py test --coverage
[testenv:docs] [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] [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 = 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] [pep8]
max-line-length = 80 max-line-length = 80