Lukas Linhart avatar Lukas Linhart committed 80774c1 Merge

Comments (0)

Files changed (2)

djangosanetesting/cases.py

             for plugin in self.required_sane_plugins:
                 if not getattr(self, "%s_plugin_started" % plugin, False):
                     raise self.SkipTest("Plugin %s from django-sane-testing required, skipping" % plugin)
-    
+
+    def _check_skipped(self):
+        if getattr(self, "skipped", False):
+            raise self.SkipTest("I've been marked to skip myself")
+
     def setUp(self):
+        self._check_skipped()
         self._check_plugins()
     
     def assert_equals(self, *args, **kwargs):

djangosanetesting/noseplugins.py

         from django.conf import settings
         if settings.DATABASE_ENGINE == 'sqlite3' \
             and (not getattr(settings, 'TEST_DATABASE_NAME', False) or settings.TEST_DATABASE_NAME == ':memory:'):
-            raise SkipTest("You're running database in memory, but trying to use live server in another thread. Skipping.")
+            self.skipped = True
+            return False
+            #raise SkipTest("You're running database in memory, but trying to use live server in another thread. Skipping.")
+        return True
 
 
     def startTest(self, test):
         test_case = get_test_case_class(test)
         test_instance = get_test_case_instance(test)
         if not self.server_started and getattr(test_case, "start_live_server", False):
-            self.check_database_multithread_compilant()
+            if not self.check_database_multithread_compilant():
+                return
             self.start_server(
                 address=getattr(settings, "LIVE_SERVER_ADDRESS", DEFAULT_LIVE_SERVER_ADDRESS),
                 port=int(getattr(settings, "LIVE_SERVER_PORT", DEFAULT_LIVE_SERVER_PORT))
                   )
             try:
                 sel.start()
+                test_case.selenium_started = True
             except Exception, err:
                 # we must catch it all as there is untyped socket exception on Windows :-]]]
                 if getattr(settings, "FORCE_SELENIUM_TESTS", False):
                     raise
                 else:
-                    raise SkipTest(err)
+                    test_case.skipped = True
+                    #raise SkipTest(err)
             else:
                 if isinstance(test.test, nose.case.MethodTestCase):
                     test.test.test.im_self.selenium = sel
                 else:
-                    raise SkipTest("I can only assign selenium to TestCase instance; argument passing will be implemented later")
+                    test_case.skipped = True
+                    #raise SkipTest("I can only assign selenium to TestCase instance; argument passing will be implemented later")
 
     def stopTest(self, test):
         test_case = get_test_case_class(test)
-        if getattr(test_case, "selenium_start", False):
+        if getattr(test_case, "selenium_started", False):
             test.test.test.im_self.selenium.stop()
             test.test.test.im_self.selenium = None
 
     def startTest(self, test):
         test_case = get_test_case_class(test)
         if getattr(test_case, "test_type", "unit") not in self.enabled_tests:
-            raise SkipTest(u"Test type %s not enabled" % getattr(test_case, "test_type", "unit"))
+            self.skipped = True
+            #raise SkipTest(u"Test type %s not enabled" % getattr(test_case, "test_type", "unit"))
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.