From: Zooko O'Whielacronx Date: Thu, 29 Nov 2012 21:11:47 +0000 (-0700) Subject: tests: add more diagnostics when code-under-test fails X-Git-Tag: allmydata-tahoe-1.10a1~36 X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer/somewhere?a=commitdiff_plain;h=73d5a059bda6cf5a9c484a6af332d764069b0ba1;p=tahoe-lafs%2Ftahoe-lafs.git tests: add more diagnostics when code-under-test fails This prints out which things are different when two sets are expected to be the same. This was useful to me when debugging the code under test. Hm, this pattern might be more generally useful... --- diff --git a/src/allmydata/test/test_repairer.py b/src/allmydata/test/test_repairer.py index 0a6eb8c3..0feaacb1 100644 --- a/src/allmydata/test/test_repairer.py +++ b/src/allmydata/test/test_repairer.py @@ -716,6 +716,9 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin, # not respond to the pre-repair filecheck prr = rr.get_post_repair_results() expected = set(self.g.get_all_serverids()) + responding_set = frozenset([s.get_serverid() for s in prr.get_servers_responding()]) + self.failIf(expected - responding_set, expected - responding_set) + self.failIf(responding_set - expected, responding_set - expected) self.failUnlessEqual(expected, set([s.get_serverid() for s in prr.get_servers_responding()]))