Ensure that errors from Alice-and-Bob tests are reported correctly if setup fails.
authorDaira Hopwood <daira@jacaranda.org>
Tue, 20 Oct 2015 20:37:05 +0000 (21:37 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Mon, 28 Dec 2015 15:30:05 +0000 (15:30 +0000)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/test/test_cli_magic_folder.py
src/allmydata/test/test_magic_folder.py

index 04f2f85f8b07f9bd66ddd93a2c4848b724cea0c1..eb243ce3142753c1b7faeecffbe801e2f6a84c72 100644 (file)
@@ -126,6 +126,9 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
     def setup_alice_and_bob(self, alice_clock=reactor, bob_clock=reactor):
         self.set_up_grid(num_clients=2)
 
+        self.alice_magicfolder = None
+        self.bob_magicfolder = None
+
         alice_magic_dir = abspath_expanduser_unicode(u"Alice-magic", base=self.basedir)
         self.mkdir_nonascii(alice_magic_dir)
         bob_magic_dir = abspath_expanduser_unicode(u"Bob-magic", base=self.basedir)
@@ -168,12 +171,6 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
                                                          bob_magic_dir, bob_clock)
             return result
         d.addCallback(get_Bob_magicfolder)
-
-        def prepare_result(result):
-            # XXX improve this
-            return (self.alice_collective_dircap, self.alice_upload_dircap, self.alice_magicfolder,
-                    self.bob_collective_dircap,   self.bob_upload_dircap,   self.bob_magicfolder)
-        d.addCallback(prepare_result)
         return d
 
 
index 5995c11b4ccde3dd789ea1409794f09045c542a7..e43a0030976948a2019184144a516693cc7c973c 100644 (file)
@@ -339,13 +339,6 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
         alice_clock = task.Clock()
         bob_clock = task.Clock()
         d = self.setup_alice_and_bob(alice_clock, bob_clock)
-        def get_results(result):
-            # XXX are these used?
-            (self.alice_collective_dircap, self.alice_upload_dircap, self.alice_magicfolder,
-             self.bob_collective_dircap,   self.bob_upload_dircap,   self.bob_magicfolder) = result
-            #print "Alice magicfolderdb is at %r" % (self.alice_magicfolder._client.basedir)
-            #print "Bob   magicfolderdb is at %r" % (self.bob_magicfolder._client.basedir)
-        d.addCallback(get_results)
 
         def _check_uploader_count(ign, name, expected):
             self.failUnlessReallyEqual(self._get_count('uploader.'+name, client=self.alice_magicfolder._client),
@@ -425,9 +418,10 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
         d.addCallback(_check_downloader_count, 'objects_downloaded', 3)
 
         def _cleanup(ign, magicfolder, clock):
-            d2 = magicfolder.finish()
-            clock.advance(0)
-            return d2
+            if magicfolder is not None:
+                d2 = magicfolder.finish()
+                clock.advance(0)
+                return d2
 
         def cleanup_Alice_and_Bob(result):
             print "cleanup alice bob test\n"