summaryrefslogtreecommitdiff
path: root/testlib.py
diff options
context:
space:
mode:
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2008-07-21 11:58:09 +0200
committerAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2008-07-21 11:58:09 +0200
commitf3b2fb7fc79a53bc318a7c07ab04831444c7084a (patch)
tree44360448a967459d0a527ae83b03f62f9e06e138 /testlib.py
parent93ae11ba36e2a59e8d85c8dba4b8bde5a28ca206 (diff)
downloadlogilab-common-f3b2fb7fc79a53bc318a7c07ab04831444c7084a.tar.gz
[testlib] backward compatibility fix
Diffstat (limited to 'testlib.py')
-rw-r--r--testlib.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/testlib.py b/testlib.py
index 6d33ba5..a3f1c19 100644
--- a/testlib.py
+++ b/testlib.py
@@ -434,10 +434,20 @@ def run(self, result, runcondition=None, options=None):
for test in self._tests:
if result.shouldStop:
break
- test(result, runcondition, options)
+ try:
+ test(result, runcondition, options)
+ except TypeError:
+ # this might happen if a raw unittest.TestCase is defined
+ # and used with python (and not pytest)
+ warn("%s should extend lgc.testlib.TestCase instead of unittest.TestCase"
+ % test)
+ test(result)
return result
unittest.TestSuite.run = run
-
+
+# backward compatibility: TestSuite might be imported from lgc.testlib
+TestSuite = unittest.TestSuite
+
# python2.3 compat
def __call__(self, *args, **kwds):
return self.run(*args, **kwds)