diff options
author | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2008-07-21 11:58:09 +0200 |
---|---|---|
committer | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2008-07-21 11:58:09 +0200 |
commit | f3b2fb7fc79a53bc318a7c07ab04831444c7084a (patch) | |
tree | 44360448a967459d0a527ae83b03f62f9e06e138 | |
parent | 93ae11ba36e2a59e8d85c8dba4b8bde5a28ca206 (diff) | |
download | logilab-common-f3b2fb7fc79a53bc318a7c07ab04831444c7084a.tar.gz |
[testlib] backward compatibility fix
-rw-r--r-- | testlib.py | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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) |