← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~gmb/launchpad/bug-984312 into lp:launchpad

 

Graham Binns has proposed merging lp:~gmb/launchpad/bug-984312 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #984312 in Launchpad itself: "test_rosetta_branches_script_oops fails intermittently when run out of order because of bug 884036"
  https://bugs.launchpad.net/launchpad/+bug/984312

For more details, see:
https://code.launchpad.net/~gmb/launchpad/bug-984312/+merge/102812

This branch fixes bug 984312 using the method suggested on the bug page. It's a bit of a kludge, but it serves the purpose for making the test resilient in a parallel environment.
-- 
https://code.launchpad.net/~gmb/launchpad/bug-984312/+merge/102812
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gmb/launchpad/bug-984312 into lp:launchpad.
=== modified file 'lib/lp/translations/tests/test_rosetta_branches_script.py'
--- lib/lp/translations/tests/test_rosetta_branches_script.py	2012-01-01 02:58:52 +0000
+++ lib/lp/translations/tests/test_rosetta_branches_script.py	2012-04-20 08:33:32 +0000
@@ -31,6 +31,16 @@
     )
 
 
+def filter_out_disconnection_oopses(oopses):
+    """Remove the bug 884036-related oopses from a set of oopses.
+
+    :return: All non-DisconnectionError or AssertionError oopses.
+    """
+    unwanted_types = ('AssertionError', 'DisconnectionError')
+    return [
+        oops for oops in oopses if oops['type'] not in unwanted_types]
+
+
 class TestRosettaBranchesScript(TestCaseWithFactory):
     """Testing the rosetta-bazaar cronscript."""
 
@@ -101,10 +111,11 @@
         # connection is *not normal*. So when both tests are run, we see 8 of
         # these oopses (4 pairs of 2); when run alone we don't.
         self.oops_capture.sync()
+        oopses = filter_out_disconnection_oopses(self.oopses)
         self.assertThat(
-            len(self.oopses), MatchesAny(Equals(1), Equals(9)),
-            "Unexpected number of OOPSes %r" % self.oopses)
-        oops_report = self.oopses[-1]
+            len(oopses), MatchesAny(Equals(1), Equals(9)),
+            "Unexpected number of OOPSes %r" % oopses)
+        oops_report = oopses[-1]
         self.assertIn(
             'INFO    Job resulted in OOPS: %s\n' % oops_report['id'], stderr)
         self.assertEqual('NoSuchRevision', oops_report['type'])