From 119346e0d0a9f3f434217ec64a1e32359b995a12 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 28 Apr 2015 10:21:10 +0100 Subject: [PATCH] Simplify test skipping. Signed-off-by: Daira Hopwood --- src/allmydata/test/test_drop_upload.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/allmydata/test/test_drop_upload.py b/src/allmydata/test/test_drop_upload.py index 95f92187..ff49f51c 100644 --- a/src/allmydata/test/test_drop_upload.py +++ b/src/allmydata/test/test_drop_upload.py @@ -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." -- 2.45.2