]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Simplify test skipping.
authorDaira Hopwood <daira@jacaranda.org>
Tue, 28 Apr 2015 09:21:10 +0000 (10:21 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 28 Apr 2015 09:21:10 +0000 (10:21 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/test/test_drop_upload.py

index 95f9218727650e95ea25ff1f03e460369317403d..ff49f51c18658e8619eadb811db83f9993fec03b 100644 (file)
@@ -73,7 +73,6 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA
     def test_db_persistence(self):
         """Test that a file upload creates an entry in the database.
         """
-        self.maybe_skip_test()
         fileutil.make_dirs(self.basedir)
         dbfile = abspath_expanduser_unicode(u"dbfile", base=self.basedir)
         db = self._createdb(dbfile)
@@ -103,7 +102,6 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA
         self.failIfEqual(was_uploaded, False)
 
     def test_uploader_start_service(self):
-        self.maybe_skip_test()
         self.set_up_grid()
 
         self.local_dir = abspath_expanduser_unicode(u"l\u00F8cal_dir", base=self.basedir)
@@ -121,7 +119,6 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA
         return d
 
     def test_move_tree(self):
-        self.maybe_skip_test()
         self.set_up_grid()
 
         self.local_dir = abspath_expanduser_unicode(u"l\u00F8cal_dir", base=self.basedir)
@@ -176,7 +173,6 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA
         a second time. This test is meant to test the database persistence along with
         the startup and shutdown code paths of the uploader.
         """
-        self.maybe_skip_test()
         self.set_up_grid()
         self.local_dir = abspath_expanduser_unicode(u"test_persistence", base=self.basedir)
         self.mkdir_nonascii(self.local_dir)
@@ -212,7 +208,6 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA
         return d
 
     def test_drop_upload(self):
-        self.maybe_skip_test()
         self.set_up_grid()
         self.local_dir = os.path.join(self.basedir, self.unicode_or_fallback(u"loc\u0101l_dir", u"local_dir"))
         self.mkdir_nonascii(self.local_dir)
@@ -297,9 +292,6 @@ class MockTest(DropUploadTestMixin, unittest.TestCase):
         DropUploadTestMixin.setUp(self)
         self.inotify = fake_inotify
 
-    def maybe_skip_test(self):
-        pass
-
     def notify_close_write(self, path):
         self.uploader._notifier.event(path, self.inotify.IN_CLOSE_WRITE)
 
@@ -342,12 +334,9 @@ class RealTest(DropUploadTestMixin, unittest.TestCase):
         DropUploadTestMixin.setUp(self)
         self.inotify = None
 
-    def maybe_skip_test(self):
-        # We should always have runtime.platform.supportsINotify, because we're using
-        # Twisted >= 10.1.
-        if sys.platform != "win32" and not runtime.platform.supportsINotify():
-            raise unittest.SkipTest("Drop-upload support can only be tested for-real on an OS that supports inotify or equivalent.")
-
     def notify_close_write(self, path):
         # Writing to the file causes the notification.
         pass
+
+if sys.platform != "win32" and not runtime.platform.supportsINotify():
+    RealTest.skip = "Drop-upload support can only be tested for-real on an OS that supports inotify or equivalent."