From: Daira Hopwood Date: Tue, 20 Oct 2015 20:37:05 +0000 (+0100) Subject: Ensure that errors from Alice-and-Bob tests are reported correctly if setup fails. X-Git-Url: https://git.rkrishnan.org/?a=commitdiff_plain;h=b5b301707b753a3a78102eb09f4d4f7f9c1cb890;p=tahoe-lafs%2Ftahoe-lafs.git Ensure that errors from Alice-and-Bob tests are reported correctly if setup fails. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/test/test_cli_magic_folder.py b/src/allmydata/test/test_cli_magic_folder.py index 04f2f85f..eb243ce3 100644 --- a/src/allmydata/test/test_cli_magic_folder.py +++ b/src/allmydata/test/test_cli_magic_folder.py @@ -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 diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py index 5995c11b..e43a0030 100644 --- a/src/allmydata/test/test_magic_folder.py +++ b/src/allmydata/test/test_magic_folder.py @@ -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"