Define py27 assertFoo methods for py26
Frequent issue a test case is failing with py26,
because the used assert method like the assertGreaterEqual
is not defined.
Adding unittest2.TestCase to the base testclass when running
tempest with py26.
Change-Id: I5184fe88485b611c033e81f82177060460da7f1e
diff --git a/tempest/test.py b/tempest/test.py
index 38b9102..457c019 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -17,6 +17,7 @@
import functools
import json
import os
+import sys
import time
import urllib
import uuid
@@ -241,10 +242,23 @@
atexit.register(validate_tearDownClass)
-
-class BaseTestCase(testtools.TestCase,
+if sys.version_info >= (2, 7):
+ class BaseDeps(testtools.TestCase,
testtools.testcase.WithAttributes,
testresources.ResourcedTestCase):
+ pass
+else:
+ # Define asserts for py26
+ import unittest2
+
+ class BaseDeps(testtools.TestCase,
+ testtools.testcase.WithAttributes,
+ testresources.ResourcedTestCase,
+ unittest2.TestCase):
+ pass
+
+
+class BaseTestCase(BaseDeps):
setUpClassCalled = False
_service = None