From a74f5d4fba716f7bafd541d9a9c3510210e9db29 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 7 Feb 2014 20:25:44 -0500 Subject: [PATCH] Mildly wound the interlopers This commit removes all the references to nose in the tempest tree. Moving forward trying to support nose which doesn't support some of the features we rely on in tempest is increasingly difficult. Please refer to this thread: http://lists.openstack.org/pipermail/openstack-dev/2014-January/024673.html for a more detailed explanation and the discussion regarding this. Change-Id: I3dee566d33efe1fb7808817b885d1680736abe6a --- requirements.txt | 1 - run_tempest.sh | 27 ++------------ run_tests.sh | 2 +- tempest/scenario/test_server_basic_ops.py | 4 --- tempest/test.py | 44 +++-------------------- tempest/tests/test_decorators.py | 6 ---- tox.ini | 25 ------------- 7 files changed, 8 insertions(+), 101 deletions(-) diff --git a/requirements.txt b/requirements.txt index 8c0f8727e2..feead92b3d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ pbr>=0.5.21,<1.0 anyjson>=0.3.3 -nose httplib2>=0.7.5 jsonschema>=2.0.0,<3.0.0 testtools>=0.9.34 diff --git a/run_tempest.sh b/run_tempest.sh index f6c330d3c2..bdd1f69005 100755 --- a/run_tempest.sh +++ b/run_tempest.sh @@ -53,12 +53,12 @@ while [ $# -gt 0 ]; do -u|--update) update=1;; -d|--debug) debug=1;; -C|--config) config_file=$2; shift;; - -s|--smoke) testrargs+="smoke"; noseargs+="--attr=type=smoke";; + -s|--smoke) testrargs+="smoke";; -t|--serial) serial=1;; -l|--logging) logging=1;; -L|--logging-config) logging_config=$2; shift;; --) [ "yes" == "$first_uu" ] || testrargs="$testrargs $1"; first_uu=no ;; - *) testrargs="$testrargs $1"; noseargs+=" $1" ;; + *) testrargs+="$testrargs $1";; esac shift done @@ -110,22 +110,6 @@ function run_tests { fi } -function run_tests_nose { - export NOSE_WITH_OPENSTACK=1 - export NOSE_OPENSTACK_COLOR=1 - export NOSE_OPENSTACK_RED=15.00 - export NOSE_OPENSTACK_YELLOW=3.00 - export NOSE_OPENSTACK_SHOW_ELAPSED=1 - export NOSE_OPENSTACK_STDOUT=1 - export TEMPEST_PY26_NOSE_COMPAT=1 - if [[ "x$noseargs" =~ "tempest" ]]; then - noseargs="$testrargs" - else - noseargs="$noseargs tempest" - fi - ${wrapper} nosetests $noseargs -} - if [ $never_venv -eq 0 ] then # Remove the virtual environment if --force used @@ -156,12 +140,7 @@ then fi fi -py_version=`${wrapper} python --version 2>&1` -if [[ $py_version =~ "2.6" ]] ; then - run_tests_nose -else - run_tests -fi +run_tests retval=$? exit $retval diff --git a/run_tests.sh b/run_tests.sh index eaa7fd7ebc..34b821b530 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -54,7 +54,7 @@ while [ $# -gt 0 ]; do -c|--coverage) coverage=1;; -t|--serial) serial=1;; --) [ "yes" == "$first_uu" ] || testrargs="$testrargs $1"; first_uu=no ;; - *) testrargs="$testrargs $1"; noseargs+=" $1" ;; + *) testrargs="$testrargs $1";; esac shift done diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py index 73ff6b40a6..57e7a22718 100644 --- a/tempest/scenario/test_server_basic_ops.py +++ b/tempest/scenario/test_server_basic_ops.py @@ -26,10 +26,6 @@ CONF = config.CONF LOG = logging.getLogger(__name__) -# NOTE(andreaf) - nose does not honour the load_tests protocol -# however it's test discovery regex will match anything -# which includes _tests. So nose would require some further -# investigation to be supported with this load_tests = testscenarios.load_tests_apply_scenarios diff --git a/tempest/test.py b/tempest/test.py index 22aa3f2225..c6e3d6e77b 100644 --- a/tempest/test.py +++ b/tempest/test.py @@ -23,7 +23,6 @@ import urllib import uuid import fixtures -import nose.plugins.attrib import testresources import testtools @@ -43,11 +42,10 @@ HTTP_SUCCESS = (200, 201, 202, 203, 204, 205, 206) def attr(*args, **kwargs): - """A decorator which applies the nose and testtools attr decorator + """A decorator which applies the testtools attr decorator - This decorator applies the nose attr decorator as well as the - the testtools.testcase.attr if it is in the list of attributes - to testtools we want to apply. + This decorator applies the testtools.testcase.attr if it is in the list of + attributes to testtools we want to apply. """ def decorator(f): @@ -60,7 +58,7 @@ def attr(*args, **kwargs): f = testtools.testcase.attr(attr)(f) if attr == 'smoke': f = testtools.testcase.attr('gate')(f) - return nose.plugins.attrib.attr(*args, **kwargs)(f) + return f return decorator @@ -194,40 +192,6 @@ def is_extension_enabled(extension_name, service): return True return False -# there is a mis-match between nose and testtools for older pythons. -# testtools will set skipException to be either -# unittest.case.SkipTest, unittest2.case.SkipTest or an internal skip -# exception, depending on what it can find. Python <2.7 doesn't have -# unittest.case.SkipTest; so if unittest2 is not installed it falls -# back to the internal class. -# -# The current nose skip plugin will decide to raise either -# unittest.case.SkipTest or its own internal exception; it does not -# look for unittest2 or the internal unittest exception. Thus we must -# monkey-patch testtools.TestCase.skipException to be the exception -# the nose skip plugin expects. -# -# However, with the switch to testr nose may not be available, so we -# require you to opt-in to this fix with an environment variable. -# -# This is temporary until upstream nose starts looking for unittest2 -# as testtools does; we can then remove this and ensure unittest2 is -# available for older pythons; then nose and testtools will agree -# unittest2.case.SkipTest is the one-true skip test exception. -# -# https://review.openstack.org/#/c/33056 -# https://github.com/nose-devs/nose/pull/699 -if 'TEMPEST_PY26_NOSE_COMPAT' in os.environ: - try: - import unittest.case.SkipTest - # convince pep8 we're using the import... - if unittest.case.SkipTest: - pass - raise RuntimeError("You have unittest.case.SkipTest; " - "no need to override") - except ImportError: - LOG.info("Overriding skipException to nose SkipTest") - testtools.TestCase.skipException = nose.plugins.skip.SkipTest at_exit_set = set() diff --git a/tempest/tests/test_decorators.py b/tempest/tests/test_decorators.py index 88920dc2dd..aa3c8fcb3b 100644 --- a/tempest/tests/test_decorators.py +++ b/tempest/tests/test_decorators.py @@ -41,10 +41,6 @@ class TestAttrDecorator(BaseDecoratorsTest): self.assertEqual(getattr(foo, '__testtools_attrs'), set(expected_attrs)) - # nose sets it anyway - for arg, value in decorator_args.items(): - self.assertEqual(getattr(foo, arg), value) - def test_attr_without_type(self): self._test_attr_helper(expected_attrs='baz', bar='baz') @@ -74,7 +70,6 @@ class TestServicesDecorator(BaseDecoratorsTest): t = TestFoo('test_bar') self.assertEqual(set(decorator_args), getattr(t.test_bar, '__testtools_attrs')) - self.assertEqual(list(decorator_args), t.test_bar.type) self.assertEqual(t.test_bar(), 0) def test_services_decorator_with_single_service(self): @@ -110,7 +105,6 @@ class TestStressDecorator(BaseDecoratorsTest): expected_frequency) self.assertEqual(getattr(foo, 'st_allow_inheritance'), expected_inheritance) - self.assertEqual(foo.type, 'stress') self.assertEqual(set(['stress']), getattr(foo, '__testtools_attrs')) def test_stresstest_decorator_default(self): diff --git a/tox.ini b/tox.ini index 1580b14906..758d681930 100644 --- a/tox.ini +++ b/tox.ini @@ -57,31 +57,6 @@ commands = commands = python setup.py testr --slowest --testr-args='tempest.scenario.test_large_ops {posargs}' - -[testenv:py26-full] -setenv = VIRTUAL_ENV={envdir} - NOSE_WITH_OPENSTACK=1 - NOSE_OPENSTACK_COLOR=1 - NOSE_OPENSTACK_RED=15 - NOSE_OPENSTACK_YELLOW=3 - NOSE_OPENSTACK_SHOW_ELAPSED=1 - NOSE_OPENSTACK_STDOUT=1 - TEMPEST_PY26_NOSE_COMPAT=1 -commands = - nosetests --logging-format '%(asctime)-15s %(message)s' --with-xunit -sv --xunit-file=nosetests-full.xml tempest/api tempest/scenario tempest/thirdparty tempest/cli {posargs} - -[testenv:py26-smoke] -setenv = VIRTUAL_ENV={envdir} -NOSE_WITH_OPENSTACK=1 - NOSE_OPENSTACK_COLOR=1 - NOSE_OPENSTACK_RED=15 - NOSE_OPENSTACK_YELLOW=3 - NOSE_OPENSTACK_SHOW_ELAPSED=1 - NOSE_OPENSTACK_STDOUT=1 - TEMPEST_PY26_NOSE_COMPAT=1 -commands = - nosetests --logging-format '%(asctime)-15s %(message)s' --with-xunit -sv --attr=type=smoke --xunit-file=nosetests-smoke.xml tempest {posargs} - [testenv:smoke] commands = bash tools/pretty_tox.sh '(?!.*\[.*\bslow\b.*\])((smoke)|(^tempest\.scenario)) {posargs}'