Пример #1
0
 def test_getNextJobStatus_wrong_type(self):
     """Only TranslationMergeJobs should result."""
     #suppress job creation.
     with EventRecorder():
         packaging = self.factory.makePackagingLink()
     TranslationSplitJob.forPackaging(packaging)
     self.assertIs(None, TranslationMergeJob.getNextJobStatus(packaging))
 def test_getNextJobStatus_wrong_type(self):
     """Only TranslationMergeJobs should result."""
     #suppress job creation.
     with EventRecorder():
         packaging = self.factory.makePackagingLink()
     TranslationSplitJob.forPackaging(packaging)
     self.assertIs(
         None, TranslationMergeJob.getNextJobStatus(packaging))
 def test_TranslationSplitJob(self):
     """Ensure TranslationSplitJob runs under Celery."""
     self.useFixture(FeatureFixture({
         'jobs.celery.enabled_classes': 'TranslationSplitJob',
     }))
     upstream_item, ubuntu_item = make_shared_potmsgset(self.factory)
     TranslationSplitJob.create(
         upstream_item.potemplate.productseries,
         ubuntu_item.potemplate.distroseries,
         ubuntu_item.potemplate.sourcepackagename,
     )
     self.assertEqual(upstream_item.potmsgset, ubuntu_item.potmsgset)
     with block_on_job(self):
         transaction.commit()
     self.assertNotEqual(upstream_item.potmsgset, ubuntu_item.potmsgset)
Пример #4
0
 def test_TranslationSplitJob(self):
     """Ensure TranslationSplitJob runs under Celery."""
     self.useFixture(
         FeatureFixture({
             'jobs.celery.enabled_classes':
             'TranslationSplitJob',
         }))
     upstream_item, ubuntu_item = make_shared_potmsgset(self.factory)
     TranslationSplitJob.create(
         upstream_item.potemplate.productseries,
         ubuntu_item.potemplate.distroseries,
         ubuntu_item.potemplate.sourcepackagename,
     )
     self.assertEqual(upstream_item.potmsgset, ubuntu_item.potmsgset)
     with block_on_job(self):
         transaction.commit()
     self.assertNotEqual(upstream_item.potmsgset, ubuntu_item.potmsgset)
Пример #5
0
 def test_run_splits_translations(self):
     upstream_item, ubuntu_item = make_shared_potmsgset(self.factory)
     job = TranslationSplitJob.create(
         upstream_item.potemplate.productseries,
         ubuntu_item.potemplate.distroseries,
         ubuntu_item.potemplate.sourcepackagename,
     )
     self.assertEqual(upstream_item.potmsgset, ubuntu_item.potmsgset)
     job.run()
     self.assertNotEqual(upstream_item.potmsgset, ubuntu_item.potmsgset)
 def test_run_splits_translations(self):
     upstream_item, ubuntu_item = make_shared_potmsgset(self.factory)
     job = TranslationSplitJob.create(
         upstream_item.potemplate.productseries,
         ubuntu_item.potemplate.distroseries,
         ubuntu_item.potemplate.sourcepackagename,
     )
     self.assertEqual(upstream_item.potmsgset, ubuntu_item.potmsgset)
     job.run()
     self.assertNotEqual(upstream_item.potmsgset, ubuntu_item.potmsgset)
 def test_merge_translations(self):
     job = make_translation_merge_job(self.factory)
     TranslationSplitJob.create(
         job.productseries, job.distroseries, job.sourcepackagename)
     transaction.commit()
     retcode, stdout, stderr = run_script(
         'cronscripts/process-job-source.py',
         ['ITranslationPackagingJobSource'],
         expect_returncode=0)
     matcher = MatchesRegex(dedent("""\
         INFO    Creating lockfile: /var/lock/launchpad-process-job-source-ITranslationPackagingJobSource.lock
         INFO    Running synchronously.
         INFO    Running <.*?TranslationMergeJob.*?> \(ID .*\) in status Waiting
         INFO    Merging .* and .* in Ubuntu Distroseries.*
         INFO    Deleted POTMsgSets: 1.  TranslationMessages: 1.
         INFO    Running <.*?TranslationSplitJob.*?> \(ID .*\) in status Waiting
         INFO    Splitting .* and .* in Ubuntu Distroseries.*
         INFO    1 entries split.
         INFO    Ran 1 TranslationMergeJob jobs.
         INFO    Ran 1 TranslationSplitJob jobs.
         """))
     self.assertThat(stderr, matcher)
     self.assertEqual('', stdout)
Пример #8
0
 def test_merge_translations(self):
     job = make_translation_merge_job(self.factory)
     TranslationSplitJob.create(job.productseries, job.distroseries,
                                job.sourcepackagename)
     transaction.commit()
     retcode, stdout, stderr = run_script(
         'cronscripts/process-job-source.py',
         ['ITranslationPackagingJobSource'],
         expect_returncode=0)
     matcher = MatchesRegex(
         dedent("""\
         INFO    Creating lockfile: /var/lock/launchpad-process-job-source-ITranslationPackagingJobSource.lock
         INFO    Running synchronously.
         INFO    Running <.*?TranslationMergeJob.*?> \(ID .*\) in status Waiting
         INFO    Merging .* and .* in Ubuntu Distroseries.*
         INFO    Deleted POTMsgSets: 1.  TranslationMessages: 1.
         INFO    Running <.*?TranslationSplitJob.*?> \(ID .*\) in status Waiting
         INFO    Splitting .* and .* in Ubuntu Distroseries.*
         INFO    1 entries split.
         INFO    Ran 1 TranslationMergeJob jobs.
         INFO    Ran 1 TranslationSplitJob jobs.
         """))
     self.assertThat(stderr, matcher)
     self.assertEqual('', stdout)