From: Brian Warner Date: Wed, 25 Feb 2009 07:01:28 +0000 (-0700) Subject: test_cli/test_web: fix spurious test failure on solaris (maybe python2.4?) due to... X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer?a=commitdiff_plain;h=7d4901197a2bfc77ebe495194e8ead4d74e3ed4d;p=tahoe-lafs%2Ftahoe-lafs.git test_cli/test_web: fix spurious test failure on solaris (maybe python2.4?) due to variations in the way that exceptions are stringified --- diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index 5dc529a5..0befb075 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -1348,7 +1348,8 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase): d.addCallback(lambda ign: self.do_cli("manifest", self.rooturi)) def _manifest_failed((rc, out, err)): self.failIfEqual(rc, 0) - self.failUnlessIn("ERROR: UnrecoverableFileError", err) + self.failUnlessIn("ERROR: ", err) + self.failUnlessIn("UnrecoverableFileError", err) # the fatal directory should still show up, as the last line self.failUnlessIn(" subdir\n", out) d.addCallback(_manifest_failed) @@ -1356,7 +1357,8 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase): d.addCallback(lambda ign: self.do_cli("deep-check", self.rooturi)) def _deep_check_failed((rc, out, err)): self.failIfEqual(rc, 0) - self.failUnlessIn("ERROR: UnrecoverableFileError", err) + self.failUnlessIn("ERROR: ", err) + self.failUnlessIn("UnrecoverableFileError", err) # we want to make sure that the error indication is the last # thing that gets emitted self.failIf("done:" in out, out) @@ -1372,7 +1374,8 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase): #def _deep_check_repair_failed((rc, out, err)): # self.failIfEqual(rc, 0) # print err - # self.failUnlessIn("ERROR: UnrecoverableFileError", err) + # self.failUnlessIn("ERROR: ", err) + # self.failUnlessIn("UnrecoverableFileError", err) # self.failIf("done:" in out, out) #d.addCallback(_deep_check_repair_failed) diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 492e406a..1663436e 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -2883,7 +2883,12 @@ class Grid(GridTestMixin, WebErrorMixin, unittest.TestCase, ShouldFailMixin): error_line = lines[first_error] error_msg = lines[first_error+1:] error_msg_s = "\n".join(error_msg) + "\n" - self.failUnlessIn("ERROR: UnrecoverableFileError", error_line) + # different pythons repr the exception differently, so sometimes + # we get "ERROR: UnrecoverableFileError", and sometimes we get + # "ERROR: ". + self.failUnlessIn("ERROR: ", error_line) + self.failUnlessIn("UnrecoverableFileError", error_line) self.failUnlessIn("no recoverable versions", error_line) self.failUnless(len(error_msg) > 2, error_msg_s) # some traceback units = [simplejson.loads(line) for line in lines[:first_error]] @@ -2904,7 +2909,8 @@ class Grid(GridTestMixin, WebErrorMixin, unittest.TestCase, ShouldFailMixin): error_line = lines[first_error] error_msg = lines[first_error+1:] error_msg_s = "\n".join(error_msg) + "\n" - self.failUnlessIn("ERROR: UnrecoverableFileError", error_line) + self.failUnlessIn("ERROR: ", error_line) + self.failUnlessIn("UnrecoverableFileError", error_line) self.failUnlessIn("no recoverable versions", error_line) self.failUnless(len(error_msg) > 2, error_msg_s) # some traceback units = [simplejson.loads(line) for line in lines[:first_error]]