Merge "Mildly wound the interlopers"

This commit is contained in:
Jenkins 2014-02-27 00:39:53 +00:00 committed by Gerrit Code Review
commit 375a62e465
7 changed files with 8 additions and 101 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

25
tox.ini
View File

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