← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/launchpad/buildfail-recipebuilder into lp:launchpad/devel

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/buildfail-recipebuilder into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers): code


This fixes spurious failures in one test, test_messagesCanStayDiverged. It also cleans up the test a bit, but the main thing is that just a switchDbUser apparently isn't always good enough. lp.testing.TestCase.becomeDbUser also throws in a commit, and that's what does the trick.
-- 
https://code.launchpad.net/~jtv/launchpad/buildfail-recipebuilder/+merge/41282
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/buildfail-recipebuilder into lp:launchpad/devel.
=== modified file 'lib/lp/translations/scripts/tests/test_message_sharing_migration.py'
--- lib/lp/translations/scripts/tests/test_message_sharing_migration.py	2010-10-05 00:08:16 +0000
+++ lib/lp/translations/scripts/tests/test_message_sharing_migration.py	2010-11-19 10:50:58 +0000
@@ -18,6 +18,7 @@
     record_statements,
     TestCaseWithFactory,
     )
+from lp.testing.sampledata import ADMIN_EMAIL
 from lp.translations.interfaces.pofiletranslator import IPOFileTranslatorSet
 from lp.translations.model.pomsgid import POMsgID
 from lp.translations.model.potemplate import POTemplate
@@ -62,8 +63,8 @@
         # This test needs the privileges of rosettaadmin (to delete
         # POTMsgSets) but it also needs to set up test conditions which
         # requires other privileges.
+        super(TestPOTMsgSetMerging, self).setUp(user=ADMIN_EMAIL)
         self.layer.switchDbUser('postgres')
-        super(TestPOTMsgSetMerging, self).setUp(user='mark@xxxxxxxxxxx')
         super(TestPOTMsgSetMerging, self).setUpProduct()
 
     def test_matchedPOTMsgSetsShare(self):
@@ -252,9 +253,9 @@
         The matching POTMsgSets will be merged by the _mergePOTMsgSets
         call.
         """
-        self.layer.switchDbUser('postgres')
         super(TestPOTMsgSetMergingAndTranslations, self).setUp(
-            user='mark@xxxxxxxxxxx')
+            user=ADMIN_EMAIL)
+        self.layer.switchDbUser('postgres')
         super(TestPOTMsgSetMergingAndTranslations, self).setUpProduct()
 
     def test_sharingDivergedMessages(self):
@@ -374,9 +375,8 @@
     layer = LaunchpadZopelessLayer
 
     def setUp(self):
+        super(TestTranslationMessageNonMerging, self).setUp(user=ADMIN_EMAIL)
         self.layer.switchDbUser('postgres')
-        super(TestTranslationMessageNonMerging, self).setUp(
-            user='mark@xxxxxxxxxxx')
         super(TestTranslationMessageNonMerging, self).setUpProduct()
 
     def test_MessagesAreNotSharedAcrossPOTMsgSets(self):
@@ -402,9 +402,9 @@
     layer = LaunchpadZopelessLayer
 
     def setUp(self):
+        super(TestTranslationMessageMerging, self).setUp(user=ADMIN_EMAIL)
+        transaction.commit()
         self.layer.switchDbUser('postgres')
-        super(TestTranslationMessageMerging, self).setUp(
-            user='mark@xxxxxxxxxxx')
         super(TestTranslationMessageMerging, self).setUpProduct()
 
     def test_messagesCanStayDiverged(self):
@@ -565,8 +565,8 @@
     layer = LaunchpadZopelessLayer
 
     def setUp(self):
+        super(TestRemoveDuplicates, self).setUp(user=ADMIN_EMAIL)
         self.layer.switchDbUser('postgres')
-        super(TestRemoveDuplicates, self).setUp(user='mark@xxxxxxxxxxx')
         super(TestRemoveDuplicates, self).setUpProduct()
 
     def test_duplicatesAreCleanedUp(self):
@@ -735,8 +735,8 @@
     layer = LaunchpadZopelessLayer
 
     def setUp(self):
-        self.layer.switchDbUser('postgres')
         super(TestSharingMigrationPerformance, self).setUp()
+        self.layer.switchDbUser('postgres')
         super(TestSharingMigrationPerformance, self).setUpProduct()
 
     def _flushDbObjects(self):