Hi Jeroen, thanks for doing this and putting up with Danilo's mess... ;-) You (two) really achieved good test coverage it seems. I have to admit I did not trace every test, though, to see if the coverage is complete. I trust you there. But I *did* run the tests and they passed. Good job! ;-) Since I could not find any real problems I had to resort to complaining about minor stuff like long method names. Also, I think I see SQLObject code introduced. Let me heare what you think about my comments and let's do another round. Cheers, Hennning > === added file 'lib/lp/translations/tests/helpers.py' > --- lib/lp/translations/tests/helpers.py 1970-01-01 00:00:00 +0000 > +++ lib/lp/translations/tests/helpers.py 2010-06-29 10:50:45 +0000 > @@ -0,0 +1,146 @@ > +# Copyright 2010 Canonical Ltd. This software is licensed under the > +# GNU Affero General Public License version 3 (see the file LICENSE). > + > +__all__ = [ > + 'get_all_important_translations', > + 'make_translationmessage', > + 'make_translationmessage_for_context', > + ] > + > +from zope.security.proxy import removeSecurityProxy > + > +from canonical.database.sqlbase import sqlvalues > + > +from lp.translations.interfaces.translationmessage import ( > + RosettaTranslationOrigin, > + TranslationValidationStatus) > +from lp.translations.model.translationmessage import ( > + TranslationMessage) > + > +def make_translationmessage_for_context(factory, pofile, potmsgset=None, > + current=True, other=False, > + diverged=False, translations=None): > + """A low-level way of constructing TMs appropriate to `pofile` context.""" > + assert pofile is not None, "You must pass in an existing POFile." > + > + potemplate = pofile.potemplate > + if potemplate.distroseries is not None: > + ubuntu = current > + upstream = other > + else: > + ubuntu = other > + upstream = current > + return make_translationmessage( > + factory, pofile, potmsgset, ubuntu, upstream, diverged, translations) > + > +def make_translationmessage(factory, pofile=None, potmsgset=None, > + ubuntu=True, upstream=True, > + diverged=False, translations=None): > + """Creates a TranslationMessage directly and sets relevant parameters. > + > + This is very low level function used to test core Rosetta > + functionality such as setCurrentTranslation() method. If not used > + correctly, it will trigger unique constraints. > + """ > + if pofile is None: > + pofile = factory.makePOFile('sr') > + if potmsgset is None: > + potmsgset = factory.makePOTMsgSet( > + potemplate=pofile.potemplate) > + if translations is None: > + translations = [factory.getUniqueString()] > + if diverged: > + potemplate = pofile.potemplate > + else: > + potemplate = None > + > + # Parameters we don't care about are origin, submitter and > + # validation_status. > + origin = RosettaTranslationOrigin.SCM > + submitter = pofile.owner > + validation_status = TranslationValidationStatus.UNKNOWN > + > + translations = dict( > + [(i, translations[i]) for i in range(len(translations))]) I just used "dict(enumerate(translations))" in the factory. Is that not the same? > + > + potranslations = removeSecurityProxy( > + potmsgset)._findPOTranslations(translations) > + new_message = TranslationMessage( > + potmsgset=potmsgset, > + potemplate=potemplate, > + pofile=None, > + language=pofile.language, > + variant=pofile.variant, > + origin=origin, > + submitter=submitter, > + msgstr0=potranslations[0], > + msgstr1=potranslations[1], > + msgstr2=potranslations[2], > + msgstr3=potranslations[3], > + msgstr4=potranslations[4], > + msgstr5=potranslations[5], > + validation_status=validation_status, > + is_current_ubuntu=ubuntu, > + is_current_upstream=upstream) > + return new_message > + > +def get_all_translations_current_anywhere(pofile, potmsgset): > + """Get all translation messages on this POTMsgSet used anywhere.""" > + used_clause = ('(is_current_ubuntu IS TRUE OR ' > + 'is_current_upstream IS TRUE)') > + template_clause = 'TranslationMessage.potemplate IS NOT NULL' > + clauses = [ > + 'potmsgset = %s' % sqlvalues(potmsgset), > + used_clause, > + template_clause, > + 'TranslationMessage.language = %s' % sqlvalues(pofile.language)] > + if pofile.variant is None: > + clauses.append('TranslationMessage.variant IS NULL') > + else: > + clauses.append( > + 'TranslationMessage.variant=%s' % sqlvalues(pofile.variant)) > + > + order_by = '-COALESCE(potemplate, -1)' > + > + return TranslationMessage.select( > + ' AND '.join(clauses), orderBy=[order_by]) This should be storm code, shouldn't it? > + > +def get_all_important_translations(pofile, potmsgset): Hm, I don't think "important" is a very useful term here as it is not very exact. > + """Return all existing current translations. See, why not call it "get_all_current_translations"? > + > + Returns a tuple containing 4 elements: > + * current, shared translation for `potmsgset`. > + * diverged translation for `potmsgset` in `pofile` or None. > + * shared translation for `potmsgset` in "other" context. > + * list of all other diverged translations (not including the one > + diverged in `pofile`) or an empty list if there are none. > + """ > + current_shared = potmsgset.getCurrentTranslationMessage( > + None, pofile.language, pofile.variant) > + current_diverged = potmsgset.getCurrentTranslationMessage( > + pofile.potemplate, pofile.language, pofile.variant) > + if (current_diverged is not None and > + current_diverged.potemplate is None): > + current_diverged = None What is this message you could get from getCurrentTranslationMessage with potemplate != None? Is that behavior intentended? > + > + other_shared = potmsgset.getImportedTranslationMessage( > + None, pofile.language, pofile.variant) > + other_diverged = potmsgset.getImportedTranslationMessage( > + pofile.potemplate, pofile.language, pofile.variant) > + assert other_diverged is None or other_diverged.potemplate is None, ( > + "There is a diverged 'other' translation for " > + "this same template, which isn't impossible.") Double negation ... ;-) > + > + all_used = get_all_translations_current_anywhere( > + pofile, potmsgset) > + diverged = [] > + for suggestion in all_used: > + if ((suggestion.potemplate is not None and > + suggestion.potemplate != pofile.potemplate) and > + (suggestion.is_current_ubuntu or > + suggestion.is_current_upstream)): > + # It's diverged for another template and current somewhere. > + diverged.append(suggestion) > + return ( > + current_shared, current_diverged, > + other_shared, diverged) > > === added file 'lib/lp/translations/tests/test_helpers.py' > --- lib/lp/translations/tests/test_helpers.py 1970-01-01 00:00:00 +0000 > +++ lib/lp/translations/tests/test_helpers.py 2010-06-29 10:50:45 +0000 > @@ -0,0 +1,133 @@ > +# Copyright 2010 Canonical Ltd. This software is licensed under the > +# GNU Affero General Public License version 3 (see the file LICENSE). > + > +__metaclass__ = type > + > +from zope.component import getUtility > + > +from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities > +from canonical.testing import ZopelessDatabaseLayer > + > +from lp.testing import TestCaseWithFactory > + > +from lp.translations.tests.helpers import ( > + make_translationmessage, > + get_all_important_translations) > + > + > +class TestTranslationMessageHelpers(TestCaseWithFactory): > + """Test discovery of translation suggestions.""" > + > + layer = ZopelessDatabaseLayer > + > + def setUp(self): > + super(TestTranslationMessageHelpers, self).setUp() > + ubuntu = getUtility(ILaunchpadCelebrities).ubuntu > + self.factory.makeDistroRelease(distribution=ubuntu) Since you are not storing the return value this call obviously produces a side effect that needs explanation. > + sourcepackagename = self.factory.makeSourcePackageName() > + potemplate = self.factory.makePOTemplate( > + distroseries=ubuntu.currentseries, And how does that series you created earlier relate to this series? > + sourcepackagename=sourcepackagename) > + self.pofile = self.factory.makePOFile('sr', potemplate=potemplate) > + self.potmsgset = self.factory.makePOTMsgSet(potemplate=potemplate, > + sequence=1) > + > + # A POFile in a different context from self.pofile. > + self.other_pofile = self.factory.makePOFile( > + language_code=self.pofile.language.code, > + variant=self.pofile.variant) > + > + def test_make_translationmessage(self): > + translations = [u"testing"] > + tm = make_translationmessage(self.factory, pofile=self.pofile, > + potmsgset=self.potmsgset, > + translations=translations) > + self.assertEquals(translations, tm.translations) > + > + def test_get_all_important_translations(self): > + current_shared, current_diverged, other, divergences = ( > + get_all_important_translations(self.pofile, self.potmsgset)) > + self.assertIs(None, current_shared) > + self.assertIs(None, current_diverged) > + self.assertIs(None, other) > + self.assertEquals([], divergences) > + > + def test_get_all_important_translations_current_shared(self): > + tm = make_translationmessage( > + self.factory, pofile=self.pofile, potmsgset=self.potmsgset, > + ubuntu=True, upstream=False, diverged=False) > + current_shared, current_diverged, other, divergences = ( > + get_all_important_translations(self.pofile, self.potmsgset)) > + self.assertEquals(tm, current_shared) > + self.assertIs(None, current_diverged) > + self.assertIs(None, other) > + self.assertEquals([], divergences) > + > + def test_get_all_important_translations_current_both(self): > + tm = make_translationmessage( > + self.factory, pofile=self.pofile, potmsgset=self.potmsgset, > + ubuntu=True, upstream=True, diverged=False) > + current_shared, current_diverged, other, divergences = ( > + get_all_important_translations(self.pofile, self.potmsgset)) > + self.assertEquals(tm, current_shared) > + self.assertIs(None, current_diverged) > + self.assertEquals(tm, other) > + self.assertEquals([], divergences) > + > + def test_get_all_important_translations_current_both_same(self): You are right, this is actually the same (i.e. identical) test as the previous one. ;-) BTW, I'd enjoy comments on each test method to know what it is about. > + tm = make_translationmessage( > + self.factory, pofile=self.pofile, potmsgset=self.potmsgset, > + ubuntu=True, upstream=True, diverged=False) > + current_shared, current_diverged, other, divergences = ( > + get_all_important_translations(self.pofile, self.potmsgset)) > + self.assertEquals(tm, current_shared) > + self.assertIs(None, current_diverged) > + self.assertEquals(tm, other) > + self.assertEquals([], divergences) > + > + def test_get_all_important_translations_current_two_different(self): > + tm_this = make_translationmessage( > + self.factory, pofile=self.pofile, potmsgset=self.potmsgset, > + ubuntu=True, upstream=False, diverged=False) > + tm_other = make_translationmessage( > + self.factory, pofile=self.pofile, potmsgset=self.potmsgset, > + ubuntu=False, upstream=True, diverged=False) > + current_shared, current_diverged, other, divergences = ( > + get_all_important_translations(self.pofile, self.potmsgset)) > + self.assertEquals(tm_this, current_shared) > + self.assertIs(None, current_diverged) > + self.assertEquals(tm_other, other) > + self.assertEquals([], divergences) > + > + def test_get_all_important_translations_current_three_different(self): > + tm_this = make_translationmessage( > + self.factory, pofile=self.pofile, potmsgset=self.potmsgset, > + ubuntu=True, upstream=False, diverged=False) > + tm_other = make_translationmessage( > + self.factory, pofile=self.pofile, potmsgset=self.potmsgset, > + ubuntu=False, upstream=True, diverged=False) > + tm_diverged = make_translationmessage( > + self.factory, pofile=self.pofile, potmsgset=self.potmsgset, > + ubuntu=True, upstream=False, diverged=True) > + current_shared, current_diverged, other, divergences = ( > + get_all_important_translations(self.pofile, self.potmsgset)) > + self.assertEquals(tm_this, current_shared) > + self.assertEquals(tm_diverged, current_diverged) > + self.assertEquals(tm_other, other) > + self.assertEquals([], divergences) > + > + def test_get_all_important_translations_current_three_diverged_elsewhere( > + self): Woa, I don't think we should be doing this, not even for test methods. Can you not find a shorter name? > + tm_diverged = make_translationmessage( > + self.factory, pofile=self.other_pofile, potmsgset=self.potmsgset, > + ubuntu=True, upstream=False, diverged=True) > + self.assertTrue(tm_diverged.is_current_ubuntu) > + self.assertEquals( > + tm_diverged.potemplate, self.other_pofile.potemplate) > + self.assertEquals(tm_diverged.potmsgset, self.potmsgset) Nitpick: you swapped the "expected, observed" order in these two. > + current_shared, current_diverged, other, divergences = ( > + get_all_important_translations(self.pofile, self.potmsgset)) > + self.assertIs(None, current_shared) > + self.assertIs(None, current_diverged) > + self.assertIs(None, other) > + self.assertEquals([tm_diverged], divergences) > > === modified file 'lib/lp/translations/tests/test_potmsgset.py' > --- lib/lp/translations/tests/test_potmsgset.py 2010-06-29 10:50:44 +0000 > +++ lib/lp/translations/tests/test_potmsgset.py 2010-06-29 10:50:45 +0000 > @@ -960,8 +960,9 @@ > self.assertTrue(translation.potemplate is None) > > def test_resetCurrentTranslation_diverged_not_imported(self): > - # Resettting a diverged current translation that was not imported, will > - # change is_current_ubuntu to False and will make it shared. > + # Resettting a diverged current translation that was not > + # imported will change is_current_ubuntu to False and will make > + # it shared. > > translation = self.factory.makeTranslationMessage( > self.pofile, self.potmsgset, translations=[u'Diverged text'], > > === added file 'lib/lp/translations/tests/test_setcurrenttranslation.py' > --- lib/lp/translations/tests/test_setcurrenttranslation.py 1970-01-01 00:00:00 +0000 > +++ lib/lp/translations/tests/test_setcurrenttranslation.py 2010-06-29 10:50:45 +0000 > @@ -0,0 +1,1186 @@ > +# Copyright 2009-2010 Canonical Ltd. This software is licensed under the > +# GNU Affero General Public License version 3 (see the file LICENSE). > + > +# pylint: disable-msg=C0102 > + > +__metaclass__ = type > + > +from zope.component import getUtility > + > +from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities > +from canonical.testing import ZopelessDatabaseLayer > + > +from lp.testing import TestCaseWithFactory > +from lp.translations.interfaces.translationmessage import ( > + RosettaTranslationOrigin) > +from lp.translations.interfaces.translations import ( > + TranslationSide) > +from lp.translations.model.translationmessage import ( > + TranslationMessage) > + > +from lp.translations.tests.helpers import ( > + make_translationmessage_for_context, > + get_all_important_translations) > + > + > +# This test is based on the matrix described on: > +# https://dev.launchpad.net/Translations/Specs > +# /UpstreamImportIntoUbuntu/FixingIsImported > +# /setCurrentTranslation#Execution%20matrix > + > +class SetCurrentTranslationTestMixin: > + """Tests for `POTMsgSet.setCurrentTranslation`.""" > + > + layer = ZopelessDatabaseLayer I think I'd rather see this in the actual TestCase class than in this Mixin. > + > + def constructTranslationMessage(self, pofile=None, potmsgset=None, > + current=True, other=False, diverged=False, > + translations=None): > + """Creates a TranslationMessage directly for `pofile` context.""" > + if pofile is None: > + pofile = self.pofile > + if potmsgset is None: > + potmsgset = self.potmsgset > + return make_translationmessage_for_context( > + self.factory, pofile, potmsgset, > + current, other, diverged, translations) > + > + def constructOtherTranslationMessage(self, potmsgset=None, current=True, > + other=False, diverged=False, > + translations=None): > + """Creates a TranslationMessage for self.other_pofile context.""" > + return self.constructTranslationMessage( > + self.other_pofile, potmsgset, current, other, diverged, > + translations) > + > + def constructDivergingTranslationMessage(self, potmsgset=None, > + current=True, other=False, > + diverged=False, > + translations=None): > + """Creates a TranslationMessage for self.diverging_pofile context.""" > + return self.constructTranslationMessage( > + self.diverging_pofile, potmsgset, current, other, diverged, > + translations) > + > + def setCurrentTranslation(self, translations, > + share_with_other_side=False): > + """Helper method to call 'setCurrentTranslation' method. > + > + It passes all the same parameters we use throughout the tests, > + including self.potmsgset, self.pofile, self.pofile.owner and origin. > + """ > + translations = dict( > + [(i, translations[i]) for i in range(len(translations))]) Again, couldn't you use "enumerate"? > + return self.potmsgset.setCurrentTranslation( > + self.pofile, self.pofile.owner, translations, > + origin=RosettaTranslationOrigin.ROSETTAWEB, > + translation_side=TranslationSide.UBUNTU, > + share_with_other_side=share_with_other_side) You refer to this as the "sharing policy" and I wonder if an enum called "sharing_policy" would not be clearer? [...] > + def test_current_None__new_None__other_diverged(self): > + # Current translation is None, and we have found no > + # existing TM matching new translations. > + # There is a current but diverged translation in "other" context. > + tm_other = self.constructOtherTranslationMessage( > + current=True, other=False, diverged=True) > + self.assert_Current_Diverged_Other_DivergencesElsewhere_are( > + None, None, None, [tm_other]) > + > + new_translations = [self.factory.getUniqueString()] > + tm = self.setCurrentTranslation(new_translations) > + > + # We end up with a shared current translation. > + self.assertTrue(tm is not None) > + self.assert_Current_Diverged_Other_DivergencesElsewhere_are( > + tm, None, None, [tm_other]) > + > + # Previously current is still diverged and current > + # in exactly one context. > + self.assertFalse(tm_other.is_current_upstream and > + tm_other.is_current_ubuntu) Wrong multiline handling for function calls. ;-) self.assertFalse( tm_other.is_current_upstream and tm_other.is_current_ubuntu) > + self.assertTrue(tm_other.is_current_upstream or > + tm_other.is_current_ubuntu) Same here and for all aother occurences in this file. > + self.assertEquals(self.other_pofile.potemplate, tm_other.potemplate) > + [...] > + def test_current_None__new_shared__other_shared__identical__follows( > + self): Good news: the self does still fit on the same line with the method name. Phew! > + # As above, and 'share_with_other_side' is a no-op in this case. > + self.test_current_None__new_shared__other_shared__identical(True) > + [...] > + def test_current_shared__new_None__other_shared__follows(self): # The sharing policy has no effect on the operation. Or something like that. > + self.test_current_shared__new_None__other_shared(follows=True) > + [...] > + def test_current_shared__new_shared__other_shared__follows(self): Same here. > + self.test_current_shared__new_shared__other_shared(follows=True) > + > + def test_current_shared__new_shared__other_shared__identical( > + self, follows=False): Hm, I really don't like this loss of readability. Maybe you should shorten all test methods by leaving out the double underscores and abbreviating the recurring terms. Something like this: def test_c_shared_n_shared_o_shared_identical(self, follows=False): I mean that for all method names in this file. A quick search and replace should be able to do that. > + # Current translation is 'shared', and we have found > + # a shared existing TM matching new translations that is > + # also current for "other" context. > + new_translations = [self.factory.getUniqueString()] > + tm_shared = self.constructTranslationMessage( > + current=True, other=False, diverged=False) > + tm_other = self.constructOtherTranslationMessage( > + current=True, other=False, diverged=False, > + translations=new_translations) > + self.assert_Current_Diverged_Other_DivergencesElsewhere_are( > + tm_shared, None, tm_other, []) > + > + tm = self.setCurrentTranslation( > + new_translations, share_with_other_side=follows) > + > + # New translation message is shared for both contexts. > + self.assertTrue(tm is not None) > + self.assertNotEquals(tm_shared, tm) > + self.assertEquals(tm_other, tm) > + self.assert_Current_Diverged_Other_DivergencesElsewhere_are( > + tm, None, tm, []) > + > + # Previous shared translation is now a suggestion. > + self.assertFalse(tm_shared.is_current_ubuntu or > + tm_shared.is_current_upstream) > + > + def test_current_shared__new_shared__other_shared__identical__follows( > + self): Yes, I definitely think you should consider shortening the names. > + # Since we are converging to the 'other' context anyway, it behaves > + # the same when 'share_with_other_side=True' is passed in. > + self.test_current_shared__new_shared__other_shared__identical(True) > + [...] > + > + def test_current_diverged__new_None__other_None__follows(self): > + # XXX DaniloSegan 20100530: I am not sure 'follows' tests > + # are needed when current is diverged: they'd make sense only > + # when we end up converging the translation. > + self.test_current_diverged__new_None__other_None(True) In any case, it should be "follows=True" to stay consistent. More instances below. [...] > + def test_current_diverged__new_shared__other_shared__identical_s__follows( > + self): Missing comment. I know this has been explained in earlier tests. I am just thinking of the time when this test fails and somebody comes here to look and has no clue what it is about. > + s = self Argh! Please, please, shorten the names. > + s.test_current_diverged__new_shared__other_shared__identical_shared( > + follows=True) > + [...] > + def test_current_diverged__new_diverged__other_diverged( > + self, follows=False): > + # Current translation is 'diverged' (no shared), and we have found > + # an existing diverged in other context TM matching new translations. > + new_translations = [self.factory.getUniqueString()] > + tm_diverged = self.constructTranslationMessage( > + current=True, other=False, diverged=True) > + tm_other_diverged = self.constructOtherTranslationMessage( > + current=True, other=False, diverged=True, > + translations=new_translations) > + self.assert_Current_Diverged_Other_DivergencesElsewhere_are( > + None, tm_diverged, None, [tm_other_diverged]) > + > + tm = self.setCurrentTranslation( > + new_translations, share_with_other_side=follows) > + > + # New translation message stays diverged and current only for > + # the active context. Existing divergence elsewhere is untouched. > + # XXX DaniloSegan 20100530: it'd be nice to have this > + # converge the diverged translation (since shared is None), > + # though it's not a requirement: (tm, None, tm_other, []) > + self.assertTrue(tm is not None) > + self.assertNotEquals(tm_diverged, tm) > + self.assertNotEquals(tm_other_diverged, tm) > + self.assert_Current_Diverged_Other_DivergencesElsewhere_are( > + None, tm, None, [tm_other_diverged]) Shouldn't there be at least one test where DivergencesElsewhere has more than one element? > + > + # Previously current is not current anymore. > + self.assertFalse(tm_diverged.is_current_ubuntu or > + tm_diverged.is_current_upstream) > + > + def test_current_diverged__new_diverged__other_diverged__follows(self): > + # XXX DaniloSegan 20100530: I am not sure 'follows' tests > + # are needed when current is diverged: they'd make sense only > + # when we end up converging the translation. > + self.test_current_diverged__new_diverged__other_diverged(True) > + > + > +class TestSetCurrentTranslation_Ubuntu(SetCurrentTranslationTestMixin, > + TestCaseWithFactory): layer = ZopelessDatabaseLayer It just looks weired without ... > + def setUp(self): > + super(TestSetCurrentTranslation_Ubuntu, self).setUp() > + ubuntu = getUtility(ILaunchpadCelebrities).ubuntu > + sharing_series = self.factory.makeDistroRelease(distribution=ubuntu) > + sourcepackagename = self.factory.makeSourcePackageName() > + potemplate = self.factory.makePOTemplate( > + distroseries=ubuntu.currentseries, > + sourcepackagename=sourcepackagename) > + sharing_potemplate = self.factory.makePOTemplate( > + distroseries=sharing_series, > + sourcepackagename=sourcepackagename, > + name=potemplate.name) > + self.pofile = self.factory.makePOFile('sr', potemplate=potemplate, > + create_sharing=True) Wrong multiline handling. Also, wrong language code (should be 'nl')... :-P > + > + # A POFile in the same context as self.pofile, used for diverged > + # translations. > + self.diverging_pofile = sharing_potemplate.getPOFileByLang( > + self.pofile.language.code, self.pofile.variant) > + > + # A POFile in a different context from self.pofile and > + # self.diverging_pofile. > + self.other_pofile = self.factory.makePOFile( > + language_code=self.pofile.language.code, > + variant=self.pofile.variant) > + > + self.potmsgset = self.factory.makePOTMsgSet(potemplate=potemplate, > + sequence=1) > + > + > +# XXX JeroenVermeulen 2010-06-29 bug=546310: we can activate this once > +# getCurrentTranslation and getImportedTranslation "change sides" based > +# on the current template: lp:~danilo/launchpad/use-upstream-translations. Great to see we have this test ready to be let loose. Thanks for doing this in this flexible manner. > + > +#class TestSetCurrentTranslation_Upstream(SetCurrentTranslationTestMixin, > +# TestCaseWithFactory): > +# def setUp(self): > +# super(TestSetCurrentTranslation_Upstream, self).setUp() > +# series = self.factory.makeProductSeries() > +# sharing_series = self.factory.makeProductSeries( > +# product=series.product) > +# potemplate = self.factory.makePOTemplate(productseries=series) > +# sharing_potemplate = self.factory.makePOTemplate( > +# productseries=sharing_series, name=potemplate.name) > +# self.pofile = self.factory.makePOFile('sr', potemplate=potemplate, > +# create_sharing=True) > +# > +# # A POFile in the same context as self.pofile, used for diverged > +# # translations. > +# self.diverging_pofile = sharing_potemplate.getPOFileByLang( > +# self.pofile.language.code, self.pofile.variant) > +# > +# # A POFile in a different context from self.pofile and > +# # self.diverging_pofile. > +# ubuntu = getUtility(ILaunchpadCelebrities).ubuntu > +# sourcepackagename = self.factory.makeSourcePackageName() > +# ubuntu_template = self.factory.makePOTemplate( > +# distroseries=ubuntu.currentseries, > +# sourcepackagename=sourcepackagename) > +# self.other_pofile = self.factory.makePOFile( > +# potemplate=ubuntu_template, > +# language_code=self.pofile.language.code, > +# variant=self.pofile.variant) > +# > +# self.potmsgset = self.factory.makePOTMsgSet(potemplate=potemplate, > +# sequence=1)