Remove redundant inotify parameters to MagicFolder and Uploader constructors.
authorDaira Hopwood <daira@jacaranda.org>
Mon, 14 Sep 2015 19:16:03 +0000 (20:16 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 15 Sep 2015 17:43:01 +0000 (18:43 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/magic_folder.py
src/allmydata/test/test_cli_magic_folder.py
src/allmydata/test/test_magic_folder.py

index a61e61c57d764b6046b25fe0a66f84b2b0cf77bd..20bcf50ae5fd52f0821c37d8b4cf5755107d7024 100644 (file)
@@ -44,7 +44,7 @@ def get_inotify_module():
 class MagicFolder(service.MultiService):
     name = 'magic-folder'
 
-    def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile, inotify=None,
+    def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile,
                  pending_delay=1.0):
         precondition_abspath(local_path_u)
 
@@ -61,7 +61,7 @@ class MagicFolder(service.MultiService):
 
         self.is_ready = False
 
-        self.uploader = Uploader(client, local_path_u, db, upload_dircap, inotify, pending_delay)
+        self.uploader = Uploader(client, local_path_u, db, upload_dircap, pending_delay)
         self.downloader = Downloader(client, local_path_u, db, collective_dircap)
 
     def startService(self):
@@ -152,7 +152,7 @@ class QueueMixin(HookMixin):
 
 
 class Uploader(QueueMixin):
-    def __init__(self, client, local_path_u, db, upload_dircap, inotify, pending_delay):
+    def __init__(self, client, local_path_u, db, upload_dircap, pending_delay):
         QueueMixin.__init__(self, client, local_path_u, db, 'uploader')
 
         print "Magic-Folder: Uploader: __init__"
@@ -165,7 +165,7 @@ class Uploader(QueueMixin):
         if self._upload_dirnode.is_unknown() or self._upload_dirnode.is_readonly():
             raise AssertionError("The URI in 'private/magic_folder_dircap' is not a writecap to a directory.")
 
-        self._inotify = inotify or get_inotify_module()
+        self._inotify = get_inotify_module()
         self._notifier = self._inotify.INotify()
 
         if hasattr(self._notifier, 'set_pending_delay'):
index 8d1eb894b8f645c14af61eef6e027e7f13abd890..560c7cb3cdabbc59b494f99264f508b9d8273911 100644 (file)
@@ -103,7 +103,7 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
     def init_magicfolder(self, client_num, upload_dircap, collective_dircap, local_magic_dir):
         dbfile = abspath_expanduser_unicode(u"magicfolderdb.sqlite", base=self.get_clientdir(i=client_num))
         magicfolder = MagicFolder(self.get_client(client_num), upload_dircap, collective_dircap, local_magic_dir,
-                                       dbfile, inotify=self.inotify, pending_delay=0.2)
+                                       dbfile, pending_delay=0.2)
         magicfolder.setServiceParent(self.get_client(client_num))
         magicfolder.ready()
         return magicfolder
@@ -112,7 +112,7 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
         dbfile = abspath_expanduser_unicode(u"private/magicfolderdb.sqlite", base=self.get_clientdir(i=client_num))
         self.collective_dircap, self.upload_dircap = self.get_caps_from_files(client_num)
         self.magicfolder = MagicFolder(self.get_client(client_num), self.upload_dircap, self.collective_dircap, self.local_dir,
-                                       dbfile, inotify=self.inotify, pending_delay=0.2)
+                                       dbfile, pending_delay=0.2)
         self.magicfolder.setServiceParent(self.get_client(client_num))
         return self.magicfolder.ready()
 
index a885df7bce8d89a0cd2b940914020d73266b7815..c46c959b94d4333da40b922b1e5db403236c5ab2 100644 (file)
@@ -59,7 +59,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
         dbfile = abspath_expanduser_unicode(u"magicfolderdb.sqlite", base=self.basedir)
         print "<>--< dbfile %s" % (dbfile,)
         self.magicfolder = MagicFolder(self.get_client(), self.upload_dircap, self.collective_dircap, self.local_dir,
-                                       dbfile, inotify=self.inotify, pending_delay=0.2)
+                                       dbfile, pending_delay=0.2)
         self.magicfolder.setServiceParent(self.get_client())
         self.magicfolder.ready()
 
@@ -431,18 +431,18 @@ class MockTest(MagicFolderTestMixin, unittest.TestCase):
             readonly_dircap = n.get_readonly_uri()
 
             self.shouldFail(AssertionError, 'nonexistent local.directory', 'there is no directory',
-                            MagicFolder, client, upload_dircap, '', doesnotexist, magicfolderdb, inotify=fake_inotify)
+                            MagicFolder, client, upload_dircap, '', doesnotexist, magicfolderdb)
             self.shouldFail(AssertionError, 'non-directory local.directory', 'is not a directory',
-                            MagicFolder, client, upload_dircap, '', not_a_dir, magicfolderdb, inotify=fake_inotify)
+                            MagicFolder, client, upload_dircap, '', not_a_dir, magicfolderdb)
             self.shouldFail(AssertionError, 'bad upload.dircap', 'does not refer to a directory',
-                            MagicFolder, client, 'bad', '', errors_dir, magicfolderdb, inotify=fake_inotify)
+                            MagicFolder, client, 'bad', '', errors_dir, magicfolderdb)
             self.shouldFail(AssertionError, 'non-directory upload.dircap', 'does not refer to a directory',
-                            MagicFolder, client, 'URI:LIT:foo', '', errors_dir, magicfolderdb, inotify=fake_inotify)
+                            MagicFolder, client, 'URI:LIT:foo', '', errors_dir, magicfolderdb)
             self.shouldFail(AssertionError, 'readonly upload.dircap', 'is not a writecap to a directory',
-                            MagicFolder, client, readonly_dircap, '', errors_dir, magicfolderdb, inotify=fake_inotify)
+                            MagicFolder, client, readonly_dircap, '', errors_dir, magicfolderdb,)
             self.shouldFail(AssertionError, 'collective dircap',
                             "The URI in 'private/collective_dircap' is not a readonly cap to a directory.",
-                            MagicFolder, client, upload_dircap, upload_dircap, errors_dir, magicfolderdb, inotify=fake_inotify)
+                            MagicFolder, client, upload_dircap, upload_dircap, errors_dir, magicfolderdb)
 
             def _not_implemented():
                 raise NotImplementedError("blah")