From 452c3ab8a805b7b3142ee7b09b5f3a22dbd744d6 Mon Sep 17 00:00:00 2001 From: Henry Gessau Date: Thu, 10 Dec 2015 00:58:12 -0500 Subject: [PATCH] Improvements to tox envs - Actually depend on requirements.txt - Run unit tests with ostestr - Inform testr of location of unit tests - Fix coverage job and include report - Keep PEP8 strict; it's not annoying yet - Remove vestiges of oslo incubator handling Change-Id: I2465d18bee8e242e049d2d5e30dfcf472a49c0c4 --- .coveragerc | 2 +- .testr.conf | 3 ++- .../tests/unit/callbacks/test_manager.py | 3 ++- openstack-common.conf | 6 ----- test-requirements.txt | 1 + tox.ini | 23 ++++++++++--------- 6 files changed, 18 insertions(+), 20 deletions(-) delete mode 100644 openstack-common.conf diff --git a/.coveragerc b/.coveragerc index 3fe82bb38..05b6f144e 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,7 +1,7 @@ [run] branch = True source = neutron_lib -omit = neutron_lib/openstack/* +omit = neutron_lib/tests/* [report] ignore_errors = True diff --git a/.testr.conf b/.testr.conf index 6d83b3c4e..7e156d765 100644 --- a/.testr.conf +++ b/.testr.conf @@ -2,6 +2,7 @@ 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 + ${PYTHON:-python} -m subunit.run discover -t ./ \ + ${OS_TEST_PATH:-./neutron_lib/tests/unit} $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list diff --git a/neutron_lib/tests/unit/callbacks/test_manager.py b/neutron_lib/tests/unit/callbacks/test_manager.py index 87f89361e..ec20900e3 100644 --- a/neutron_lib/tests/unit/callbacks/test_manager.py +++ b/neutron_lib/tests/unit/callbacks/test_manager.py @@ -115,7 +115,8 @@ class CallBacksManagerTestCase(base.BaseTestCase): callback_1, resources.PORT, events.BEFORE_CREATE) self.assertNotIn(callback_id_1, self.manager._index) self.assertNotIn(callback_id_1, - self.manager._callbacks[resources.PORT][events.BEFORE_CREATE]) + self.manager._callbacks[resources.PORT] + [events.BEFORE_CREATE]) def test_unsubscribe_by_resource(self): self.manager.subscribe( diff --git a/openstack-common.conf b/openstack-common.conf deleted file mode 100644 index 63f2e3b53..000000000 --- a/openstack-common.conf +++ /dev/null @@ -1,6 +0,0 @@ -[DEFAULT] - -# The list of modules to copy from oslo-incubator.git - -# The base module to hold the copy of openstack.common -base=neutron_lib diff --git a/test-requirements.txt b/test-requirements.txt index eeb9a3f33..678f7d10c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -10,6 +10,7 @@ python-subunit>=0.0.18 sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 +os-testr>=0.4.1 testrepository>=0.0.18 testscenarios>=0.4 testtools>=1.4.0 diff --git a/tox.ini b/tox.ini index c19113c0b..190a8d751 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,19 @@ [tox] -minversion = 1.6 +minversion = 2.0 envlist = py34,py27,pep8 skipsdist = True [testenv] usedevelop = True +passenv = TRACE_FAILONLY install_command = pip install -U {opts} {packages} setenv = - VIRTUAL_ENV={envdir} -deps = -r{toxinidir}/test-requirements.txt -commands = python setup.py test --slowest --testr-args='{posargs}' + VIRTUAL_ENV={envdir} +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = + ostestr --regex '{posargs}' [testenv:pep8] commands = flake8 @@ -18,7 +22,9 @@ commands = flake8 commands = {posargs} [testenv:cover] -commands = python setup.py test --coverage --testr-args='{posargs}' +commands = + python setup.py test --coverage --coverage-package-name=neutron_lib --testr-args='{posargs}' + coverage report [testenv:docs] commands = sphinx-build -W -b html doc/source doc/build/html @@ -27,11 +33,6 @@ commands = sphinx-build -W -b html doc/source doc/build/html commands = oslo_debug_helper {posargs} [flake8] -# E123, E125 skipped as they are invalid PEP-8. -# E126 continuation line over-indented for hanging indent -# E128 continuation line under-indented for visual indent - show-source = True -ignore = E123,E125,E126,E128 builtins = _ -exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build +exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build