launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00773
[Merge] lp:~henninge/launchpad/recife-pofile-creation into lp:~launchpad/launchpad/recife
Henning Eggers has proposed merging lp:~henninge/launchpad/recife-pofile-creation into lp:~launchpad/launchpad/recife.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This is a follow-up to this merge:
https://code.launchpad.net/~henninge/launchpad/bug-545354-enable-sharing/+merge/27123
It add tests that show that when a new POFile is created, it is also created in sharing sourcepackages and upstream projects. POTemplate._createPOFilesInSharingPOTemplates uses POTemplateSharingSubset.getSharingPOTemplates which implements finding sharing templates across source packages and upstream projects.
Run the new tests like this:
bin/test -vvcm lp.translations.tests.test_pofile -t test_pofile_creation_shared_
--
https://code.launchpad.net/~henninge/launchpad/recife-pofile-creation/+merge/33800
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~henninge/launchpad/recife-pofile-creation into lp:~launchpad/launchpad/recife.
=== modified file 'lib/lp/translations/tests/test_pofile.py'
--- lib/lp/translations/tests/test_pofile.py 2010-08-24 07:12:53 +0000
+++ lib/lp/translations/tests/test_pofile.py 2010-08-26 16:30:58 +0000
@@ -18,6 +18,7 @@
from zope.security.proxy import removeSecurityProxy
from canonical.database.constants import UTC_NOW
+from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.webapp.publisher import canonical_url
from canonical.testing import (
LaunchpadZopelessLayer,
@@ -950,6 +951,72 @@
self.assertEqual(pofile_devel.language.code,
pofile_stable.language.code)
+ def test_pofile_creation_shared_upstream(self):
+ # When a pofile is created in a POTemplate of an Ubuntu package
+ # it is also created in all shared templates in the upstream project.
+ # POTemplate is 'shared' if it has the same name ('messages').
+ ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
+ hoary = ubuntu ['hoary']
+ packagename = self.factory.makeSourcePackageName()
+ sourcepackage = self.factory.makeSourcePackage(packagename, hoary)
+ sourcepackage.setPackaging(self.foo_devel, self.factory.makePerson())
+ sourcepackage.setPackaging(self.foo_stable, self.factory.makePerson())
+ package_potemplate = self.factory.makePOTemplate(
+ distroseries=hoary, sourcepackagename=packagename,
+ name="messages")
+ devel_potemplate = self.factory.makePOTemplate(
+ productseries=self.foo_devel, name="messages")
+ stable_potemplate = self.factory.makePOTemplate(
+ productseries=self.foo_stable, name="messages")
+
+ self.assertEqual(None, devel_potemplate.getPOFileByLang('eo'))
+ self.assertEqual(None, stable_potemplate.getPOFileByLang('eo'))
+
+ package_pofile = package_potemplate.newPOFile('eo')
+
+ devel_pofile = devel_potemplate.getPOFileByLang('eo')
+ self.assertNotEqual(None, devel_pofile)
+ stable_pofile = stable_potemplate.getPOFileByLang('eo')
+ self.assertNotEqual(None, stable_pofile)
+
+ def test_pofile_creation_shared_in_ubuntu(self):
+ # When a pofile is created in a POTemplate of project it is also
+ # created in all shared templates in the linked Ubuntu package.
+ # POTemplate is 'shared' if it has the same name ('messages').
+ ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
+ hoary = ubuntu ['hoary']
+ warty = ubuntu['warty']
+ packagename = self.factory.makeSourcePackageName()
+ hoary_package = self.factory.makeSourcePackage(packagename, hoary)
+ warty_package = self.factory.makeSourcePackage(packagename, warty)
+ self.factory.makeSourcePackagePublishingHistory(
+ sourcepackagename=packagename, distroseries=hoary)
+ self.factory.makeSourcePackagePublishingHistory(
+ sourcepackagename=packagename, distroseries=warty)
+ owner = self.factory.makePerson()
+ self.foo_stable.setPackaging(hoary, packagename, owner)
+ self.foo_stable.setPackaging(warty, packagename, owner)
+
+
+ stable_potemplate = self.factory.makePOTemplate(
+ productseries=self.foo_stable, name="messages")
+ hoary_potemplate = self.factory.makePOTemplate(
+ distroseries=hoary, sourcepackagename=packagename,
+ name="messages")
+ warty_potemplate = self.factory.makePOTemplate(
+ distroseries=warty, sourcepackagename=packagename,
+ name="messages")
+
+ self.assertEqual(None, hoary_potemplate.getPOFileByLang('eo'))
+ self.assertEqual(None, warty_potemplate.getPOFileByLang('eo'))
+
+ stable_pofile = stable_potemplate.newPOFile('eo')
+
+ hoary_pofile = hoary_potemplate.getPOFileByLang('eo')
+ self.assertNotEqual(None, hoary_pofile)
+ warty_pofile = warty_potemplate.getPOFileByLang('eo')
+ self.assertNotEqual(None, warty_pofile)
+
def test_pofile_creation_not_shared(self):
# When a pofile is created in a POTemplate it is not created in
# other templates that are not shared.