From 58e84748593c82bb05f5e5cc29459af81e80f0a6 Mon Sep 17 00:00:00 2001
From: David Stainton <dstainton415@gmail.com>
Date: Thu, 28 Jan 2016 17:43:40 +0000
Subject: [PATCH] Further work in progress refinements to unit tests

wip from pairing with Daira and Meejah
---
 src/allmydata/frontends/magic_folder.py | 4 ++--
 src/allmydata/test/test_magic_folder.py | 8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py
index 22273915..afe26081 100644
--- a/src/allmydata/frontends/magic_folder.py
+++ b/src/allmydata/frontends/magic_folder.py
@@ -175,7 +175,7 @@ class QueueMixin(HookMixin):
                 self._lazy_tail.addBoth(self._logcb, "whawhat else %r" % (item,))
                 self._lazy_tail.addCallback(lambda ign: self._process(item))
                 self._lazy_tail.addBoth(self._logcb, "got past _process")
-                self._lazy_tail.addBoth(self._call_hook, 'processed')
+                self._lazy_tail.addBoth(self._call_hook, 'processed', async=True)
                 self._lazy_tail.addBoth(self._logcb, "got past _call_hook (turn_delay = %r)" % (self._turn_delay,))
                 self._lazy_tail.addCallback(lambda ign: task.deferLater(self._clock, self._turn_delay, self._turn_deque))
                 self._lazy_tail.addBoth(self._logcb, "got past deferLater")
@@ -688,7 +688,7 @@ class Downloader(QueueMixin, WriteFileMixin):
                     self._deque.append( (relpath_u, file_node, metadata) )
                 else:
                     self._log("Excluding %r" % (relpath_u,))
-                    self._call_hook(None, 'processed')
+                    self._call_hook(None, 'processed', async=True)
 
             self._log("deque after = %r" % (self._deque,))
         d.addCallback(_filter_batch_to_deque)
diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py
index 7920ec58..494ed86c 100644
--- a/src/allmydata/test/test_magic_folder.py
+++ b/src/allmydata/test/test_magic_folder.py
@@ -849,8 +849,12 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
         def notify_bob_moved(ign):
             d0 = self.bob_magicfolder.uploader.set_hook('processed')
             p = abspath_expanduser_unicode(u"file1", base=self.bob_magicfolder.uploader._local_path_u)
-            self.notify(to_filepath(p), self.inotify.IN_MOVED_FROM, magic=self.bob_magicfolder, flush=False)
-            self.notify(to_filepath(p + u'.backup'), self.inotify.IN_MOVED_TO, magic=self.bob_magicfolder)
+            if sys.platform == "win32":
+                self.notify(to_filepath(p), self.inotify.IN_MOVED_FROM, magic=self.bob_magicfolder, flush=False)
+                self.notify(to_filepath(p + u'.backup'), self.inotify.IN_MOVED_TO, magic=self.bob_magicfolder)
+            else:
+                self.notify(to_filepath(p + u'.backup'), self.inotify.IN_CREATE, magic=self.bob_magicfolder, flush=False)
+                self.notify(to_filepath(p), self.inotify.IN_DELETE, magic=self.bob_magicfolder)
             bob_clock.advance(0)
             return d0
         d.addCallback(notify_bob_moved)
-- 
2.45.2