From 90ef81ca403b25c60761dc50f7ae105221032ab2 Mon Sep 17 00:00:00 2001
From: Daira Hopwood <daira@jacaranda.org>
Date: Tue, 9 Jun 2015 00:38:02 +0100
Subject: [PATCH] Fix test errors.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---
 src/allmydata/client.py                | 4 ++--
 src/allmydata/frontends/drop_upload.py | 7 +------
 src/allmydata/test/test_client.py      | 1 +
 src/allmydata/test/test_drop_upload.py | 2 +-
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/allmydata/client.py b/src/allmydata/client.py
index ab06cfb0..b0d598ba 100644
--- a/src/allmydata/client.py
+++ b/src/allmydata/client.py
@@ -14,7 +14,7 @@ from allmydata.immutable.upload import Uploader
 from allmydata.immutable.offloaded import Helper
 from allmydata.control import ControlServer
 from allmydata.introducer.client import IntroducerClient
-from allmydata.util import hashutil, base32, pollmixin, log, keyutil, idlib
+from allmydata.util import fileutil, hashutil, base32, pollmixin, log, keyutil, idlib
 from allmydata.util.encodingutil import get_filesystem_encoding, \
      from_utf8_or_none
 from allmydata.util.fileutil import abspath_expanduser_unicode
@@ -508,7 +508,7 @@ class Client(node.Node, pollmixin.PollMixin):
                 dbfile = abspath_expanduser_unicode(dbfile)
 
                 parent_dircap_path = os.path.join(self.basedir, "private", "magic_folder_parent_dircap")
-                parent_dircap_path = abspath_expanduser_unicode(magic_folder_parent_dircap)
+                parent_dircap_path = abspath_expanduser_unicode(parent_dircap_path)
                 parent_dircap = fileutil.read(parent_dircap_path).strip()
 
                 s = drop_upload.DropUploader(self, upload_dircap, parent_dircap, local_dir, dbfile)
diff --git a/src/allmydata/frontends/drop_upload.py b/src/allmydata/frontends/drop_upload.py
index d4504328..4c4d017d 100644
--- a/src/allmydata/frontends/drop_upload.py
+++ b/src/allmydata/frontends/drop_upload.py
@@ -58,12 +58,7 @@ class DropUploader(service.MultiService):
         self._upload_deque = deque()
         self.is_upload_ready = False
 
-        if inotify is None:
-            if sys.platform == "win32":
-                from allmydata.windows import inotify
-            else:
-                from twisted.internet import inotify
-        self._inotify = inotify
+        self._inotify = inotify or get_inotify_module()
 
         if not self._local_path.exists():
             raise AssertionError("The '[drop_upload] local.directory' parameter was %s "
diff --git a/src/allmydata/test/test_client.py b/src/allmydata/test/test_client.py
index e45fbb66..0547d7a0 100644
--- a/src/allmydata/test/test_client.py
+++ b/src/allmydata/test/test_client.py
@@ -328,6 +328,7 @@ class Basic(testutil.ReallyEqualMixin, testutil.NonASCIIPathMixin, unittest.Test
 
         basedir1 = "test_client.Basic.test_create_drop_uploader1"
         os.mkdir(basedir1)
+
         fileutil.write(os.path.join(basedir1, "tahoe.cfg"),
                        config + "local.directory = " + local_dir_utf8 + "\n")
         self.failUnlessRaises(MissingConfigEntry, client.Client, basedir1)
diff --git a/src/allmydata/test/test_drop_upload.py b/src/allmydata/test/test_drop_upload.py
index 999e0be5..6be6d33c 100644
--- a/src/allmydata/test/test_drop_upload.py
+++ b/src/allmydata/test/test_drop_upload.py
@@ -362,7 +362,7 @@ class MockTest(DropUploadTestMixin, unittest.TestCase):
                 raise NotImplementedError("blah")
             self.patch(drop_upload, 'get_inotify_module', _not_implemented)
             self.shouldFail(NotImplementedError, 'unsupported', 'blah',
-                            DropUploader, client, upload_dircap, errors_dir, magicfolderdb)
+                            DropUploader, client, upload_dircap, '', errors_dir, magicfolderdb)
         d.addCallback(_check_errors)
         return d
 
-- 
2.45.2