From 522cfe0951d5c25d156e0fd89b3ec8ecf449e2d9 Mon Sep 17 00:00:00 2001 From: Attila Fazekas Date: Fri, 11 Apr 2014 11:14:07 +0200 Subject: [PATCH] tempest py26 setup Simplifying the steps between devstack install and tempest run, by * installing tox<1.7, bacuse 1.7 is not compatible with our tox.ini * installing and patching 'discover' when the python version is 2.6 Change-Id: I8008837d2fae6cebeeeb051b63066279ca477e01 --- files/patches/unittest2-discover.patch | 16 ++++++++++++++++ lib/tempest | 4 +--- tools/fixup_stuff.sh | 7 +++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 files/patches/unittest2-discover.patch diff --git a/files/patches/unittest2-discover.patch b/files/patches/unittest2-discover.patch new file mode 100644 index 0000000000..347300d172 --- /dev/null +++ b/files/patches/unittest2-discover.patch @@ -0,0 +1,16 @@ +diff -r b2efb7df637b discover.py +--- a/discover.py Thu Mar 24 00:31:02 2011 -0400 ++++ b/discover.py Thu Nov 28 12:02:19 2013 +0000 +@@ -82,7 +82,11 @@ + """ + testMethodPrefix = 'test' + sortTestMethodsUsing = cmp +- suiteClass = unittest.TestSuite ++ try: ++ import unittest2 ++ suiteClass = unittest2.TestSuite ++ except ImportError: ++ suiteClass = unittest.TestSuite + _top_level_dir = None + + def loadTestsFromTestCase(self, testCaseClass): diff --git a/lib/tempest b/lib/tempest index 2125f883ee..e899443bef 100644 --- a/lib/tempest +++ b/lib/tempest @@ -88,9 +88,6 @@ function configure_tempest { local boto_instance_type="m1.tiny" local ssh_connect_method="fixed" - # TODO(afazekas): - # sudo python setup.py deploy - # Save IFS ifs=$IFS @@ -406,6 +403,7 @@ function create_tempest_accounts { # install_tempest() - Collect source and prepare function install_tempest { git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH + pip_install "tox<1.7" } # init_tempest() - Initialize ec2 images diff --git a/tools/fixup_stuff.sh b/tools/fixup_stuff.sh index 7833278a12..e6a6a79876 100755 --- a/tools/fixup_stuff.sh +++ b/tools/fixup_stuff.sh @@ -145,4 +145,11 @@ if [[ $DISTRO =~ (rhel6) ]]; then # work unmolested. sudo ln -sf /usr/bin/nosetests1.1 /usr/local/bin/nosetests + # workaround for https://code.google.com/p/unittest-ext/issues/detail?id=79 + install_package python-unittest2 patch + pip_install discover + (cd /usr/lib/python2.6/site-packages/; sudo patch <"$FILES/patches/unittest2-discover.patch" || echo 'Assume already applied') + # Make sure the discover.pyc is up to date + sudo rm /usr/lib/python2.6/site-packages/discover.pyc || true + sudo python -c 'import discover' fi