When a TC failed to initiliase the database, the following test are SKIPPED stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 25 Mar 2010 15:11:44 +0100
branchstable
changeset 5020 30a539c2074d
parent 5019 72734c210836
child 5029 f7709d28fb79
When a TC failed to initiliase the database, the following test are SKIPPED When a TC failed to initiliase the database, the other test of the same TestCase are skipped with an explicite message instead of failing later for with an unrelated message.
devtools/testlib.py
--- a/devtools/testlib.py	Thu Mar 25 15:08:27 2010 +0100
+++ b/devtools/testlib.py	Thu Mar 25 15:11:44 2010 +0100
@@ -248,7 +248,14 @@
 
     def setUp(self):
         pause_tracing()
-        self._init_repo()
+        previous_failure = self.__class__.__dict__.get('_repo_init_failed')
+        if previous_failure is not None:
+            self.skip('repository is not initialised: %r' % previous_failure)
+        try:
+            self._init_repo()
+        except Exception, ex:
+            self.__class__._repo_init_failed = ex
+            raise
         resume_tracing()
         self.setup_database()
         self.commit()