当前位置: 首页>>代码示例>>Python>>正文


Python SoyuzTestPublisher.prepareBreezyAutotest方法代码示例

本文整理汇总了Python中lp.soyuz.tests.test_publishing.SoyuzTestPublisher.prepareBreezyAutotest方法的典型用法代码示例。如果您正苦于以下问题:Python SoyuzTestPublisher.prepareBreezyAutotest方法的具体用法?Python SoyuzTestPublisher.prepareBreezyAutotest怎么用?Python SoyuzTestPublisher.prepareBreezyAutotest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lp.soyuz.tests.test_publishing.SoyuzTestPublisher的用法示例。


在下文中一共展示了SoyuzTestPublisher.prepareBreezyAutotest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_copy_archive_without_leak

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
 def test_copy_archive_without_leak(self):
     # If source publications are copied to a .COPY archive, they don't
     # "leak" into SourcePackage.getBuildRecords().
     admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
     # Set up a distroseries and related bits, so we can create builds.
     source_name = self.factory.getUniqueString()
     spn = self.factory.makeSourcePackageName(name=source_name)
     processor = self.factory.makeProcessor()
     distroseries = self.factory.makeDistroSeries()
     das = self.factory.makeDistroArchSeries(
         distroseries=distroseries, processor=processor,
         supports_virtualized=True)
     with person_logged_in(admin):
         publisher = SoyuzTestPublisher()
         publisher.prepareBreezyAutotest()
         publisher.addFakeChroots(distroseries=distroseries)
         distroseries.nominatedarchindep = das
         self.factory.makeBuilder(processor=processor)
     spph = self.factory.makeSourcePackagePublishingHistory(
         sourcepackagename=spn, distroseries=distroseries)
     spph.createMissingBuilds()
     # Create a copy archive.
     copy = self.factory.makeArchive(
         purpose=ArchivePurpose.COPY,
         distribution=distroseries.distribution)
     # And copy the publication into it.
     copy_spph = spph.copyTo(
         distroseries, PackagePublishingPocket.RELEASE, copy)
     [copy_build] = copy_spph.createMissingBuilds()
     builds = copy.getBuildRecords()
     self.assertEquals([copy_build], list(builds))
     source = SourcePackage(spn, spph.distroseries)
     # SourcePackage.getBuildRecords() doesn't have two build records.
     builds = source.getBuildRecords().count()
     self.assertEquals(1, builds)
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:37,代码来源:test_hasbuildrecords.py

示例2: setUp

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
 def setUp(self):
     super(TestBuildPrivacy, self).setUp()
     # Add everything we need to create builds.
     self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
     processor = self.factory.makeProcessor()
     distroseries = self.factory.makeDistroSeries()
     das = self.factory.makeDistroArchSeries(
         distroseries=distroseries, processor=processor,
         supports_virtualized=True)
     with person_logged_in(self.admin):
         publisher = SoyuzTestPublisher()
         publisher.prepareBreezyAutotest()
         distroseries.nominatedarchindep = das
         publisher.addFakeChroots(distroseries=distroseries)
         self.factory.makeBuilder(processor=processor)
     self.public_archive = self.factory.makeArchive()
     self.private_archive = self.factory.makeArchive(private=True)
     # Create one public and one private build.
     public_spph = publisher.getPubSource(
         sourcename=self.factory.getUniqueString(),
         version="%s.1" % self.factory.getUniqueInteger(),
         distroseries=distroseries, archive=self.public_archive)
     [public_build] = public_spph.createMissingBuilds()
     private_spph = publisher.getPubSource(
         sourcename=self.factory.getUniqueString(),
         version="%s.1" % self.factory.getUniqueInteger(),
         distroseries=distroseries, archive=self.private_archive)
     with person_logged_in(self.admin):
         [private_build] = private_spph.createMissingBuilds()
     self.expected_title = '%s build of %s %s in %s %s RELEASE' % (
         das.architecturetag, private_spph.source_package_name,
         private_spph.source_package_version,
         distroseries.distribution.name, distroseries.name)
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:35,代码来源:test_build_privacy.py

示例3: TestBuildJobBase

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
class TestBuildJobBase(TestCaseWithFactory):
    """Setup the test publisher and some builders."""

    layer = LaunchpadZopelessLayer

    def setUp(self):
        super(TestBuildJobBase, self).setUp()
        self.publisher = SoyuzTestPublisher()
        self.publisher.prepareBreezyAutotest()

        self.i8 = self.factory.makeBuilder(name='i386-n-8', virtualized=False)
        self.i9 = self.factory.makeBuilder(name='i386-n-9', virtualized=False)

        processor = getUtility(IProcessorSet).getByName('hppa')
        self.h6 = self.factory.makeBuilder(
            name='hppa-n-6', processor=processor, virtualized=False)
        self.h7 = self.factory.makeBuilder(
            name='hppa-n-7', processor=processor, virtualized=False)

        self.builders = dict()
        # x86 native
        self.builders[(1, False)] = [self.i8, self.i9]

        # hppa native
        self.builders[(3, True)] = [self.h6, self.h7]

        # Ensure all builders are operational.
        for builders in self.builders.values():
            for builder in builders:
                builder.builderok = True
                builder.manual = False

        # Disable the sample data builders.
        getUtility(IBuilderSet)['bob'].builderok = False
        getUtility(IBuilderSet)['frog'].builderok = False
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:37,代码来源:test_buildpackagejob.py

示例4: create_child

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
def create_child(factory):
    processor = factory.makeProcessor()
    parent = factory.makeDistroSeries()
    parent_das = factory.makeDistroArchSeries(distroseries=parent, processor=processor)
    lf = factory.makeLibraryFileAlias()
    # Since the LFA needs to be in the librarian, commit.
    transaction.commit()
    parent_das.addOrUpdateChroot(lf)
    with celebrity_logged_in("admin"):
        parent_das.supports_virtualized = True
        parent.nominatedarchindep = parent_das
        publisher = SoyuzTestPublisher()
        publisher.prepareBreezyAutotest()
        packages = {"udev": "0.1-1", "libc6": "2.8-1"}
        for package in packages.keys():
            publisher.getPubBinaries(
                distroseries=parent,
                binaryname=package,
                version=packages[package],
                status=PackagePublishingStatus.PUBLISHED,
            )
        test1 = getUtility(IPackagesetSet).new(u"test1", u"test 1 packageset", parent.owner, distroseries=parent)
        test1_packageset_id = str(test1.id)
        test1.addSources("udev")
    parent.updatePackageCount()
    child = factory.makeDistroSeries()
    getUtility(ISourcePackageFormatSelectionSet).add(child, SourcePackageFormat.FORMAT_1_0)
    # Make sure everything hits the database, switching db users aborts.
    transaction.commit()
    return parent, child, test1_packageset_id
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:32,代码来源:test_initializedistroseriesjob.py

示例5: TestBuildStartEstimation

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
class TestBuildStartEstimation(TestCaseWithFactory):

    layer = LaunchpadFunctionalLayer

    def setUp(self):
        super(TestBuildStartEstimation, self).setUp()
        self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
        with person_logged_in(self.admin):
            self.publisher = SoyuzTestPublisher()
            self.publisher.prepareBreezyAutotest()
            for buildd in getUtility(IBuilderSet):
                buildd.builderok = True
        self.distroseries = self.factory.makeDistroSeries()
        self.bob = getUtility(IBuilderSet).getByName(BOB_THE_BUILDER_NAME)
        das = self.factory.makeDistroArchSeries(
            distroseries=self.distroseries, processor=self.bob.processor,
            architecturetag='i386', supports_virtualized=True)
        with person_logged_in(self.admin):
            self.distroseries.nominatedarchindep = das
        self.publisher.addFakeChroots(distroseries=self.distroseries)

    def job_start_estimate(self, build):
        return build.buildqueue_record.getEstimatedJobStartTime()

    def test_estimation(self):
        pkg = self.publisher.getPubSource(
            sourcename=self.factory.getUniqueString(),
            distroseries=self.distroseries)
        build = pkg.createMissingBuilds()[0]
        now = datetime.now(pytz.UTC)
        estimate = self.job_start_estimate(build)
        self.assertTrue(estimate > now)

    def test_disabled_archives(self):
        pkg1 = self.publisher.getPubSource(
            sourcename=self.factory.getUniqueString(),
            distroseries=self.distroseries)
        [build1] = pkg1.createMissingBuilds()
        build1.buildqueue_record.lastscore = 1000
        # No user-serviceable parts inside
        removeSecurityProxy(build1.buildqueue_record).estimated_duration = (
            timedelta(minutes=10))
        pkg2 = self.publisher.getPubSource(
            sourcename=self.factory.getUniqueString(),
            distroseries=self.distroseries)
        [build2] = pkg2.createMissingBuilds()
        build2.buildqueue_record.lastscore = 100
        now = datetime.now(pytz.UTC)
        # Since build1 is higher priority, it's estimated dispatch time is now
        estimate = self.job_start_estimate(build1)
        self.assertEquals(5, (estimate - now).seconds)
        # And build2 is next, so must take build1's duration into account
        estimate = self.job_start_estimate(build2)
        self.assertEquals(600, (estimate - now).seconds)
        # If we disable build1's archive, build2 is next
        with person_logged_in(self.admin):
            build1.archive.disable()
        estimate = self.job_start_estimate(build2)
        self.assertEquals(5, (estimate - now).seconds)
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:61,代码来源:test_build_start_estimation.py

示例6: TestDistributionHasBuildRecords

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
class TestDistributionHasBuildRecords(TestCaseWithFactory):
    """Populate a distroseries with builds"""

    layer = LaunchpadZopelessLayer

    def setUp(self):
        super(TestDistributionHasBuildRecords, self).setUp()
        self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
        # Create the machinery we need to create builds, such as
        # DistroArchSeries and builders.
        self.processor_one = self.factory.makeProcessor()
        self.processor_two = self.factory.makeProcessor()
        self.distroseries = self.factory.makeDistroSeries()
        self.distribution = self.distroseries.distribution
        self.das_one = self.factory.makeDistroArchSeries(
            distroseries=self.distroseries, processor=self.processor_one,
            supports_virtualized=True)
        self.das_two = self.factory.makeDistroArchSeries(
            distroseries=self.distroseries, processor=self.processor_two,
            supports_virtualized=True)
        self.archive = self.factory.makeArchive(
            distribution=self.distroseries.distribution,
            purpose=ArchivePurpose.PRIMARY)
        self.arch_ids = [arch.id for arch in self.distroseries.architectures]
        with person_logged_in(self.admin):
            self.publisher = SoyuzTestPublisher()
            self.publisher.prepareBreezyAutotest()
            self.distroseries.nominatedarchindep = self.das_one
            self.publisher.addFakeChroots(distroseries=self.distroseries)
            self.builder_one = self.factory.makeBuilder(
                processor=self.processor_one)
            self.builder_two = self.factory.makeBuilder(
                processor=self.processor_two)
        self.builds = []
        self.createBuilds()

    def createBuilds(self):
        for i in range(5):
            # Create some test builds.
            spph = self.publisher.getPubSource(
                sourcename=self.factory.getUniqueString(),
                version="%s.%s" % (self.factory.getUniqueInteger(), i),
                distroseries=self.distroseries, architecturehintlist='any')
            builds = spph.createMissingBuilds()
            for b in builds:
                b.updateStatus(BuildStatus.BUILDING)
                if i == 4:
                    b.updateStatus(BuildStatus.FAILEDTOBUILD)
                else:
                    b.updateStatus(BuildStatus.FULLYBUILT)
                b.buildqueue_record.destroySelf()
            self.builds += builds

    def test_get_build_records(self):
        # A Distribution also implements IHasBuildRecords.
        builds = self.distribution.getBuildRecords().count()
        self.assertEquals(10, builds)
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:59,代码来源:test_hasbuildrecords.py

示例7: test_switch_privacy_with_pubs_fails

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
    def test_switch_privacy_with_pubs_fails(self):
        # Changing the privacy is not possible when the archive already
        # has published sources.
        public_ppa = self.factory.makeArchive(private=False)
        publisher = SoyuzTestPublisher()
        publisher.prepareBreezyAutotest()

        private_ppa = self.factory.makeArchive(private=True)
        publisher.getPubSource(archive=public_ppa)
        publisher.getPubSource(archive=private_ppa)

        self.assertRaises(
            CannotSwitchPrivacy, setattr, public_ppa, 'private', True)

        self.assertRaises(
            CannotSwitchPrivacy, setattr, private_ppa, 'private', False)
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:18,代码来源:test_archive_privacy.py

示例8: TestBuildDepWait

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
class TestBuildDepWait(TestCaseWithFactory):

    layer = LaunchpadFunctionalLayer

    def setUp(self):
        super(TestBuildDepWait, self).setUp()
        self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
        # Create everything we need to create builds, such as a
        # DistroArchSeries and a builder.
        self.processor = self.factory.makeProcessor()
        self.distroseries = self.factory.makeDistroSeries()
        self.das = self.factory.makeDistroArchSeries(
            distroseries=self.distroseries, processor=self.processor,
            supports_virtualized=True)
        self.archive = self.factory.makeArchive(
            distribution=self.distroseries.distribution,
            purpose=ArchivePurpose.PRIMARY)
        with person_logged_in(self.admin):
            self.publisher = SoyuzTestPublisher()
            self.publisher.prepareBreezyAutotest()
            self.distroseries.nominatedarchindep = self.das
            self.publisher.addFakeChroots(distroseries=self.distroseries)
            self.builder = self.factory.makeBuilder(processor=self.processor)

    def test_update_dependancies(self):
        # Calling .updateDependencies() on a build will remove those which
        # are reachable.
        spph = self.publisher.getPubSource(
            sourcename=self.factory.getUniqueString(),
            version="%s.1" % self.factory.getUniqueInteger(),
            distroseries=self.distroseries, archive=self.archive)
        [build] = spph.createMissingBuilds()
        spn = self.factory.getUniqueString()
        version = "%s.1" % self.factory.getUniqueInteger()
        with person_logged_in(self.admin):
            build.updateStatus(
                BuildStatus.MANUALDEPWAIT,
                slave_status={'dependencies': unicode(spn)})
            [bpph] = self.publisher.getPubBinaries(
                binaryname=spn, distroseries=self.distroseries,
                version=version, builder=self.builder, archive=self.archive,
                status=PackagePublishingStatus.PUBLISHED)
            # Commit to make sure stuff hits the database.
            transaction.commit()
        build.updateDependencies()
        self.assertEquals(u'', build.dependencies)

    def test_update_dependancies_respects_component(self):
        # Since main can only utilise packages that are published in main,
        # dependencies are not satisfied if they are not in main.
        spph = self.publisher.getPubSource(
            sourcename=self.factory.getUniqueString(),
            version="%s.1" % self.factory.getUniqueInteger(),
            distroseries=self.distroseries, archive=self.archive)
        [build] = spph.createMissingBuilds()
        spn = self.factory.getUniqueString()
        version = "%s.1" % self.factory.getUniqueInteger()
        with person_logged_in(self.admin):
            build.updateStatus(
                BuildStatus.MANUALDEPWAIT,
                slave_status={'dependencies': unicode(spn)})
            [bpph] = self.publisher.getPubBinaries(
                binaryname=spn, distroseries=self.distroseries,
                version=version, builder=self.builder, archive=self.archive,
                status=PackagePublishingStatus.PUBLISHED,
                component='universe')
            # Commit to make sure stuff hits the database.
            transaction.commit()
        build.updateDependencies()
        # Since the dependency is in universe, we still can't see it.
        self.assertEquals(unicode(spn), build.dependencies)
        with person_logged_in(self.admin):
            bpph.component = getUtility(IComponentSet)['main']
            transaction.commit()
        # Now that we have moved it main, we can see it.
        build.updateDependencies()
        self.assertEquals(u'', build.dependencies)
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:79,代码来源:test_build_depwait.py

示例9: TestDistributionSourcePackageFindRelatedArchives

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
class TestDistributionSourcePackageFindRelatedArchives(TestCaseWithFactory):

    layer = LaunchpadZopelessLayer

    def setUp(self):
        """Publish some gedit sources in main and PPAs."""
        super(TestDistributionSourcePackageFindRelatedArchives, self).setUp()

        self.distribution = getUtility(IDistributionSet)['ubuntutest']

        # Create two PPAs for gedit.
        self.archives = {}
        self.archives['ubuntu-main'] = self.distribution.main_archive
        self.archives['gedit-nightly'] = self.factory.makeArchive(
            name="gedit-nightly", distribution=self.distribution)
        self.archives['gedit-beta'] = self.factory.makeArchive(
            name="gedit-beta", distribution=self.distribution)

        self.publisher = SoyuzTestPublisher()
        self.publisher.prepareBreezyAutotest()

        # Publish gedit in all three archives.
        self.person_nightly = self.factory.makePerson()
        self.gedit_nightly_src_hist = self.publisher.getPubSource(
            sourcename="gedit", archive=self.archives['gedit-nightly'],
            creator=self.person_nightly,
            status=PackagePublishingStatus.PUBLISHED)

        self.person_beta = self.factory.makePerson()
        self.gedit_beta_src_hist = self.publisher.getPubSource(
            sourcename="gedit", archive=self.archives['gedit-beta'],
            creator=self.person_beta,
            status=PackagePublishingStatus.PUBLISHED)
        self.gedit_main_src_hist = self.publisher.getPubSource(
            sourcename="gedit", archive=self.archives['ubuntu-main'],
            status=PackagePublishingStatus.PUBLISHED)

        # Save the gedit source package for easy access.
        self.source_package = self.distribution.getSourcePackage('gedit')

        # Add slightly more soyuz karma for person_nightly for this package.
        switch_dbuser('karma')
        self.person_beta_karma = KarmaTotalCache(
            person=self.person_beta, karma_total=200)
        self.person_nightly_karma = KarmaTotalCache(
            person=self.person_nightly, karma_total=201)
        switch_dbuser('launchpad')

    def test_order_by_soyuz_package_karma(self):
        # Returned archives are ordered by the soyuz karma of the
        # package uploaders for the particular package

        related_archives = self.source_package.findRelatedArchives()
        related_archive_names = [
            archive.name for archive in related_archives]

        self.assertEqual(related_archive_names, [
            'gedit-nightly',
            'gedit-beta',
            ])

        # Update the soyuz karma for person_beta for this package so that
        # it is greater than person_nightly's.
        switch_dbuser('karma')
        self.person_beta_karma.karma_total = 202
        switch_dbuser('launchpad')

        related_archives = self.source_package.findRelatedArchives()
        related_archive_names = [
            archive.name for archive in related_archives]

        self.assertEqual(related_archive_names, [
            'gedit-beta',
            'gedit-nightly',
            ])

    def test_require_package_karma(self):
        # Only archives where the related package was created by a person
        # with the required soyuz karma for this package.

        related_archives = self.source_package.findRelatedArchives(
            required_karma=201)
        related_archive_names = [
            archive.name for archive in related_archives]

        self.assertEqual(related_archive_names, ['gedit-nightly'])

    def test_development_version(self):
        # IDistributionSourcePackage.development_version is the ISourcePackage
        # for the current series of the distribution.
        dsp = self.factory.makeDistributionSourcePackage()
        series = self.factory.makeDistroSeries(distribution=dsp.distribution)
        self.assertEqual(series, dsp.distribution.currentseries)
        development_version = dsp.distribution.currentseries.getSourcePackage(
            dsp.sourcepackagename)
        self.assertEqual(development_version, dsp.development_version)

    def test_development_version_no_current_series(self):
        # IDistributionSourcePackage.development_version is the ISourcePackage
        # for the current series of the distribution.
#.........这里部分代码省略.........
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:103,代码来源:test_distributionsourcepackage.py

示例10: TestBuild

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
class TestBuild(TestCaseWithFactory):

    layer = LaunchpadFunctionalLayer

    def setUp(self):
        super(TestBuild, self).setUp()
        self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
        self.processor = self.factory.makeProcessor()
        self.distroseries = self.factory.makeDistroSeries()
        self.das = self.factory.makeDistroArchSeries(
            distroseries=self.distroseries, processor=self.processor,
            supports_virtualized=True)
        with person_logged_in(self.admin):
            self.publisher = SoyuzTestPublisher()
            self.publisher.prepareBreezyAutotest()
            self.distroseries.nominatedarchindep = self.das
            self.publisher.addFakeChroots(distroseries=self.distroseries)
            self.builder = self.factory.makeBuilder(processor=self.processor)
        self.now = datetime.now(pytz.UTC)

    def test_title(self):
        # A build has a title which describes the context source version and
        # in which series and architecture it is targeted for.
        spph = self.publisher.getPubSource(
            sourcename=self.factory.getUniqueString(),
            version="%s.1" % self.factory.getUniqueInteger(),
            distroseries=self.distroseries)
        [build] = spph.createMissingBuilds()
        expected_title = '%s build of %s %s in %s %s RELEASE' % (
            self.das.architecturetag, spph.source_package_name,
            spph.source_package_version, self.distroseries.distribution.name,
            self.distroseries.name)
        self.assertEquals(expected_title, build.title)

    def test_linking(self):
        # A build directly links to the archive, distribution, distroseries,
        # distroarchseries, pocket in its context and also the source version
        # that generated it.
        spph = self.publisher.getPubSource(
            sourcename=self.factory.getUniqueString(),
            version="%s.1" % self.factory.getUniqueInteger(),
            distroseries=self.distroseries)
        [build] = spph.createMissingBuilds()
        self.assertEquals(self.distroseries.main_archive, build.archive)
        self.assertEquals(self.distroseries.distribution, build.distribution)
        self.assertEquals(self.distroseries, build.distro_series)
        self.assertEquals(self.das, build.distro_arch_series)
        self.assertEquals(PackagePublishingPocket.RELEASE, build.pocket)
        self.assertEquals(self.das.architecturetag, build.arch_tag)
        self.assertTrue(build.is_virtualized)
        self.assertEquals(
            '%s - %s' % (spph.source_package_name,
                spph.source_package_version),
            build.source_package_release.title)

    def test_processed_builds(self):
        # Builds which were already processed also offer additional
        # information about its process such as the time it was started and
        # finished and its 'log' and 'upload_changesfile' as librarian files.
        spn = self.factory.getUniqueString()
        version = "%s.1" % self.factory.getUniqueInteger()
        spph = self.publisher.getPubSource(
            sourcename=spn, version=version,
            distroseries=self.distroseries,
            status=PackagePublishingStatus.PUBLISHED)
        with person_logged_in(self.admin):
            binary = self.publisher.getPubBinaries(binaryname=spn,
                distroseries=self.distroseries, pub_source=spph,
                version=version, builder=self.builder)
        build = binary[0].binarypackagerelease.build
        self.assertTrue(build.was_built)
        self.assertEquals(
            PackageUploadStatus.DONE, build.package_upload.status)
        self.assertEquals(
            datetime(2008, 01, 01, 0, 0, 0, tzinfo=pytz.UTC),
            build.date_started)
        self.assertEquals(
            datetime(2008, 01, 01, 0, 5, 0, tzinfo=pytz.UTC),
            build.date_finished)
        self.assertEquals(timedelta(minutes=5), build.duration)
        expected_buildlog = 'buildlog_%s-%s-%s.%s_%s_FULLYBUILT.txt.gz' % (
            self.distroseries.distribution.name, self.distroseries.name,
            self.das.architecturetag, spn, version)
        self.assertEquals(expected_buildlog, build.log.filename)
        url_start = (
            'http://launchpad.dev/%s/+source/%s/%s/+build/%s/+files' % (
                self.distroseries.distribution.name, spn, version, build.id))
        expected_buildlog_url = '%s/%s' % (url_start, expected_buildlog)
        self.assertEquals(expected_buildlog_url, build.log_url)
        expected_changesfile = '%s_%s_%s.changes' % (
            spn, version, self.das.architecturetag)
        self.assertEquals(
            expected_changesfile, build.upload_changesfile.filename)
        expected_changesfile_url = '%s/%s' % (url_start, expected_changesfile)
        self.assertEquals(expected_changesfile_url, build.changesfile_url)
        # Since this build was sucessful, it can not be retried
        self.assertFalse(build.can_be_retried)

    def test_current_component(self):
        # The currently published component is provided via the
#.........这里部分代码省略.........
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:103,代码来源:test_build.py

示例11: TestDistroSeriesBinaryPackage

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
class TestDistroSeriesBinaryPackage(TestCaseWithFactory):

    layer = LaunchpadZopelessLayer

    def setUp(self):
        """Create a distroseriesbinarypackage to play with."""
        super(TestDistroSeriesBinaryPackage, self).setUp()
        self.publisher = SoyuzTestPublisher()
        self.publisher.prepareBreezyAutotest()
        self.distroseries = self.publisher.distroseries
        self.distribution = self.distroseries.distribution
        binaries = self.publisher.getPubBinaries(
            binaryname='foo-bin', summary='Foo is the best')
        binary_pub = binaries[0]
        self.binary_package_name = (
            binary_pub.binarypackagerelease.binarypackagename)
        self.distroseries_binary_package = DistroSeriesBinaryPackage(
            self.distroseries, self.binary_package_name)

    def test_cache_attribute_when_two_cache_objects(self):
        # We have situations where there are cache objects for each
        # distro archive - we need to handle this situation without
        # OOPSing - see bug 580181.
        distro_archive_1 = self.distribution.main_archive
        distro_archive_2 = self.distribution.all_distro_archives[1]

        # Publish the same binary in another distro archive.
        self.publisher.getPubBinaries(
            binaryname='foo-bin', summary='Foo is the best',
            archive=distro_archive_2)

        logger = BufferLogger()
        with dbuser(config.statistician.dbuser):
            DistroSeriesPackageCache._update(
                self.distroseries, self.binary_package_name, distro_archive_1,
                logger)

            DistroSeriesPackageCache._update(
                self.distroseries, self.binary_package_name, distro_archive_2,
                logger)

        self.failUnlessEqual(
            'Foo is the best', self.distroseries_binary_package.summary)

    def test_none_cache_passed_at_init_counts_as_cached(self):
        # If the value None is passed as the constructor parameter
        # "cache", it is considered as a valid value.
        # Accesing the property DistroSeriesBinaryPackage.cache
        # later does not lead to the execution of an SQL query to
        # retrieve a DistroSeriesPackageCache record.
        binary_package = DistroSeriesBinaryPackage(
            self.distroseries, self.binary_package_name, cache=None)
        with StormStatementRecorder() as recorder:
            binary_package.cache
        self.assertThat(recorder, HasQueryCount(Equals(0)))

        # If the parameter "cache" was not passed, accessing
        # DistroSeriesBinaryPackage.cache for the first time requires
        # at least one SQL query.
        with StormStatementRecorder() as recorder:
            self.distroseries_binary_package.cache
        self.assertThat(recorder, HasQueryCount(NotEquals(0)))
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:64,代码来源:test_distroseriesbinarypackage.py

示例12: TestSourcePublicationListingExtra

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
class TestSourcePublicationListingExtra(BrowserTestCase):
    layer = LaunchpadFunctionalLayer

    def setUp(self):
        super(TestSourcePublicationListingExtra, self).setUp()
        self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
        # Create everything we need to create builds, such as a
        # DistroArchSeries and a builder.
        self.processor = self.factory.makeProcessor()
        self.distroseries = self.factory.makeDistroSeries()
        self.das = self.factory.makeDistroArchSeries(
            distroseries=self.distroseries, processor=self.processor,
            supports_virtualized=True)
        self.archive = self.factory.makeArchive(
            distribution=self.distroseries.distribution)
        with person_logged_in(self.admin):
            self.publisher = SoyuzTestPublisher()
            self.publisher.prepareBreezyAutotest()
            self.distroseries.nominatedarchindep = self.das
            self.publisher.addFakeChroots(distroseries=self.distroseries)
            self.builder = self.factory.makeBuilder(processor=self.processor)

    def test_view_with_source_package_recipe(self):
        # When a SourcePackageRelease is linked to a
        # SourcePackageRecipeBuild, the view shows which recipe was
        # responsible for creating the SPR.
        sprb = self.factory.makeSourcePackageRecipeBuild(
            archive=self.archive)
        recipe = sprb.recipe
        requester = sprb.requester
        spph = self.publisher.getPubSource(
            archive=self.archive, status=PackagePublishingStatus.PUBLISHED)
        spph.sourcepackagerelease.source_package_recipe_build = sprb
        recipe_link_matches = soupmatchers.HTMLContains(
            soupmatchers.Tag(
                'link to build', 'a', attrs={'href': canonical_url(sprb)},
                text='Built'),
            soupmatchers.Tag(
                'recipe name', 'a', attrs={'href': canonical_url(recipe)},
                text=recipe.name),
            soupmatchers.Tag(
                'requester', 'a',
                attrs={
                    'href': canonical_url(requester)},
                text=requester.displayname))
        browser = self.getViewBrowser(spph, '+listing-archive-extra')
        self.assertThat(browser.contents, recipe_link_matches)

    def test_view_without_source_package_recipe(self):
        # And if a SourcePackageRelease is not linked, there is no sign of it
        # in the view.
        spph = self.publisher.getPubSource(
            archive=self.archive, status=PackagePublishingStatus.PUBLISHED)
        browser = self.getViewBrowser(spph, '+listing-archive-extra')
        self.assertNotIn('Built by recipe', browser.contents)

    def test_view_with_deleted_source_package_recipe(self):
        # If a SourcePackageRelease is linked to a deleted recipe, the text
        # 'deleted recipe' is displayed, rather than a link.
        sprb = self.factory.makeSourcePackageRecipeBuild(
            archive=self.archive)
        recipe = sprb.recipe
        requester = sprb.requester
        spph = self.publisher.getPubSource(
            archive=self.archive, status=PackagePublishingStatus.PUBLISHED)
        spph.sourcepackagerelease.source_package_recipe_build = sprb
        with person_logged_in(recipe.owner):
            recipe.destroySelf()
        recipe_link_matches = soupmatchers.HTMLContains(
            soupmatchers.Tag(
                'link to build', 'a',
                attrs={'href': canonical_url(sprb)},
                text='Built'),
            soupmatchers.Tag(
                'requester', 'a',
                attrs={
                    'href': canonical_url(requester)},
                text=requester.displayname))
        browser = self.getViewBrowser(spph, '+listing-archive-extra')
        self.assertThat(browser.contents, recipe_link_matches)
        self.assertIn('deleted recipe', browser.contents)
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:83,代码来源:test_publishing.py

示例13: TestBuildSet

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
class TestBuildSet(TestCaseWithFactory):

    layer = LaunchpadFunctionalLayer

    def setUp(self):
        super(TestBuildSet, self).setUp()
        self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
        self.processor_one = self.factory.makeProcessor()
        self.processor_two = self.factory.makeProcessor()
        self.distroseries = self.factory.makeDistroSeries()
        self.distribution = self.distroseries.distribution
        self.das_one = self.factory.makeDistroArchSeries(
            distroseries=self.distroseries, processor=self.processor_one,
            supports_virtualized=True)
        self.das_two = self.factory.makeDistroArchSeries(
            distroseries=self.distroseries, processor=self.processor_two,
            supports_virtualized=True)
        self.archive = self.factory.makeArchive(
            distribution=self.distroseries.distribution,
            purpose=ArchivePurpose.PRIMARY)
        with person_logged_in(self.admin):
            self.publisher = SoyuzTestPublisher()
            self.publisher.prepareBreezyAutotest()
            self.distroseries.nominatedarchindep = self.das_one
            self.publisher.addFakeChroots(distroseries=self.distroseries)
            self.builder_one = self.factory.makeBuilder(
                processor=self.processor_one)
            self.builder_two = self.factory.makeBuilder(
                processor=self.processor_two)
        self.builds = []
        self.spphs = []

    def setUpBuilds(self):
        for i in range(5):
            # Create some test builds
            spph = self.publisher.getPubSource(
                sourcename=self.factory.getUniqueString(),
                version="%s.%s" % (self.factory.getUniqueInteger(), i),
                distroseries=self.distroseries, architecturehintlist='any')
            self.spphs.append(spph)
            builds = spph.createMissingBuilds()
            with person_logged_in(self.admin):
                for b in builds:
                    b.updateStatus(BuildStatus.BUILDING)
                    if i == 4:
                        b.updateStatus(BuildStatus.FAILEDTOBUILD)
                    else:
                        b.updateStatus(BuildStatus.FULLYBUILT)
                    b.buildqueue_record.destroySelf()
            self.builds += builds

    def test_get_for_distro_distribution(self):
        # Test fetching builds for a distro's main archives
        self.setUpBuilds()
        set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
            self.distribution)
        self.assertEquals(set.count(), 10)

    def test_get_for_distro_distroseries(self):
        # Test fetching builds for a distroseries' main archives
        self.setUpBuilds()
        set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
            self.distroseries)
        self.assertEquals(set.count(), 10)

    def test_get_for_distro_distroarchseries(self):
        # Test fetching builds for a distroarchseries' main archives
        self.setUpBuilds()
        set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
            self.das_one)
        self.assertEquals(set.count(), 5)

    def test_get_for_distro_filter_build_status(self):
        # The result can be filtered based on the build status
        self.setUpBuilds()
        set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
            self.distribution, status=BuildStatus.FULLYBUILT)
        self.assertEquals(set.count(), 8)

    def test_get_for_distro_filter_name(self):
        # The result can be filtered based on the name
        self.setUpBuilds()
        spn = self.builds[2].source_package_release.sourcepackagename.name
        set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
            self.distribution, name=spn)
        self.assertEquals(set.count(), 2)

    def test_get_for_distro_filter_pocket(self):
        # The result can be filtered based on the pocket of the build
        self.setUpBuilds()
        set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
            self.distribution, pocket=PackagePublishingPocket.RELEASE)
        self.assertEquals(set.count(), 10)
        set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
            self.distribution, pocket=PackagePublishingPocket.UPDATES)
        self.assertEquals(set.count(), 0)

    def test_get_for_distro_filter_arch_tag(self):
        # The result can be filtered based on the archtag of the build
        self.setUpBuilds()
#.........这里部分代码省略.........
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:103,代码来源:test_build_set.py

示例14: TestBuildNotify

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
class TestBuildNotify(TestCaseWithFactory):

    layer = LaunchpadFunctionalLayer

    def setUp(self):
        super(TestBuildNotify, self).setUp()
        self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
        # Create all of the items we need to create builds
        self.processor = self.factory.makeProcessor()
        self.distroseries = self.factory.makeDistroSeries()
        self.das = self.factory.makeDistroArchSeries(
            distroseries=self.distroseries, processor=self.processor,
            supports_virtualized=True)
        self.creator = self.factory.makePerson(email='[email protected]')
        self.gpgkey = self.factory.makeGPGKey(owner=self.creator)
        self.archive = self.factory.makeArchive(
            distribution=self.distroseries.distribution,
            purpose=ArchivePurpose.PRIMARY)
        self.ppa = self.factory.makeArchive()
        buildd_admins = getUtility(IPersonSet).getByName(
            'launchpad-buildd-admins')
        self.buildd_admins_email = []
        with person_logged_in(self.admin):
            self.publisher = SoyuzTestPublisher()
            self.publisher.prepareBreezyAutotest()
            self.distroseries.nominatedarchindep = self.das
            self.publisher.addFakeChroots(distroseries=self.distroseries)
            self.builder = self.factory.makeBuilder(processor=self.processor)
            for member in buildd_admins.activemembers:
                self.buildd_admins_email.append(member.preferredemail.email)
        self.builds = []

    def create_builds(self, archive):
        for status in BuildStatus.items:
            spph = self.publisher.getPubSource(
                sourcename=self.factory.getUniqueString(),
                version="%s.%s" % (
                    self.factory.getUniqueInteger(), status.value),
                distroseries=self.distroseries, architecturehintlist='any',
                creator=self.creator, archive=archive)
            spph.sourcepackagerelease.dscsigningkey = self.gpgkey
            [build] = spph.createMissingBuilds()
            with person_logged_in(self.admin):
                build.updateStatus(BuildStatus.BUILDING, builder=self.builder)
                build.updateStatus(status,
                    date_finished=(
                        build.date_started + timedelta(
                            minutes=5 * (status.value + 1))))
                if status != BuildStatus.BUILDING:
                    build.buildqueue_record.destroySelf()
                else:
                    build.buildqueue_record.builder = self.builder
            self.builds.append(build)

    def _assert_mail_is_correct(self, build, notification, ppa=False):
        # Assert that the mail sent (which is in notification), matches
        # the data from the build
        self.assertEquals('[email protected]',
            notification['X-Creator-Recipient'])
        self.assertEquals(
            self.das.architecturetag, notification['X-Launchpad-Build-Arch'])
        self.assertEquals(
            'main', notification['X-Launchpad-Build-Component'])
        self.assertEquals(
            build.status.name, notification['X-Launchpad-Build-State'])
        if ppa is True:
            self.assertEquals(
                get_ppa_reference(self.ppa), notification['X-Launchpad-PPA'])
        body = notification.get_payload(decode=True)
        build_log = 'None'
        if ppa is True:
            archive = '%s PPA' % get_ppa_reference(build.archive)
            source = 'not available'
        else:
            archive = '%s primary archive' % (
                self.distroseries.distribution.name)
            source = canonical_url(build.distributionsourcepackagerelease)
        builder = canonical_url(build.builder)
        if build.status == BuildStatus.BUILDING:
            duration = 'not finished'
            build_log = 'see builder page'
        elif (
            build.status == BuildStatus.SUPERSEDED or
            build.status == BuildStatus.NEEDSBUILD):
            duration = 'not available'
            build_log = 'not available'
            builder = 'not available'
        elif build.status == BuildStatus.UPLOADING:
            duration = 'uploading'
            build_log = 'see builder page'
            builder = 'not available'
        else:
            duration = DurationFormatterAPI(
                build.duration).approximateduration()
        expected_body = dedent("""
         * Source Package: %s
         * Version: %s
         * Architecture: %s
         * Archive: %s
         * Component: main
#.........这里部分代码省略.........
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:103,代码来源:test_build_notify.py

示例15: TestDetermineArchitecturesToBuild

# 需要导入模块: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 别名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import prepareBreezyAutotest [as 别名]
class TestDetermineArchitecturesToBuild(TestCaseWithFactory):
    """Test that determine_architectures_to_build correctly interprets hints.
    """

    layer = LaunchpadZopelessLayer

    def setUp(self):
        super(TestDetermineArchitecturesToBuild, self).setUp()
        self.publisher = SoyuzTestPublisher()
        self.publisher.prepareBreezyAutotest()
        armel = self.factory.makeProcessor('armel', 'armel', 'armel')
        self.publisher.breezy_autotest.newArch(
            'armel', armel, False, self.publisher.person)
        self.publisher.addFakeChroots()

    def assertArchitecturesToBuild(self, expected_arch_tags, pub,
                                   allowed_arch_tags=None):
        if allowed_arch_tags is None:
            allowed_archs = self.publisher.breezy_autotest.architectures
        else:
            allowed_archs = [
                arch for arch in self.publisher.breezy_autotest.architectures
                if arch.architecturetag in allowed_arch_tags]
        architectures = determine_architectures_to_build(
            pub.sourcepackagerelease.architecturehintlist, pub.archive,
            self.publisher.breezy_autotest, allowed_archs)
        self.assertContentEqual(
            expected_arch_tags, [a.architecturetag for a in architectures])

    def assertArchsForHint(self, hint_string, expected_arch_tags,
                           allowed_arch_tags=None, sourcename=None):
        """Assert that the given hint resolves to the expected archtags."""
        pub = self.publisher.getPubSource(
            sourcename=sourcename, architecturehintlist=hint_string)
        self.assertArchitecturesToBuild(
            expected_arch_tags, pub, allowed_arch_tags=allowed_arch_tags)

    def test_single_architecture(self):
        # A hint string with a single arch resolves to just that arch.
        self.assertArchsForHint('hppa', ['hppa'])

    def test_three_architectures(self):
        # A hint string with multiple archs resolves to just those
        # archs.
        self.assertArchsForHint('amd64 i386 hppa', ['hppa', 'i386'])

    def test_independent(self):
        # 'all' is special, meaning just a single build. The
        # nominatedarchindep architecture is used -- in this case i386.
        self.assertArchsForHint('all', ['i386'])

    def test_one_and_independent(self):
        # 'all' is redundant if we have another build anyway.
        self.assertArchsForHint('hppa all', ['hppa'])

    def test_fictional_and_independent(self):
        # But 'all' is useful if present with an arch that wouldn't
        # generate a build.
        self.assertArchsForHint('foo all', ['i386'])

    def test_wildcard(self):
        # 'any' is a wildcard that matches all available archs.
        self.assertArchsForHint('any', ['armel', 'hppa', 'i386'])

    def test_kernel_specific_architecture(self):
        # Since we only support Linux-based architectures, 'linux-foo'
        # is treated the same as 'foo'.
        self.assertArchsForHint('linux-hppa', ['hppa'])

    def test_unknown_kernel_specific_architecture(self):
        # Non-Linux architectures aren't supported.
        self.assertArchsForHint('kfreebsd-hppa', [])

    def test_kernel_wildcard_architecture(self):
        # Wildcards work for kernels: 'any-foo' is treated like 'foo'.
        self.assertArchsForHint('any-hppa', ['hppa'])

    def test_kernel_wildcard_architecture_arm(self):
        # The second part of a wildcard matches the canonical CPU name, not
        # on the Debian architecture, so 'any-arm' matches 'armel'.
        self.assertArchsForHint('any-arm', ['armel'])

    def test_kernel_specific_architecture_wildcard(self):
        # Wildcards work for archs too: 'linux-any' is treated like 'any'.
        self.assertArchsForHint('linux-any', ['armel', 'hppa', 'i386'])

    def test_unknown_kernel_specific_architecture_wildcard(self):
        # But unknown kernels continue to result in nothing.
        self.assertArchsForHint('kfreebsd-any', [])

    def test_wildcard_and_independent(self):
        # 'all' continues to be ignored alongside a valid wildcard.
        self.assertArchsForHint('all linux-any', ['armel', 'hppa', 'i386'])

    def test_kernel_independent_is_invalid(self):
        # 'linux-all' isn't supported.
        self.assertArchsForHint('linux-all', [])

    def test_double_wildcard_is_same_as_single(self):
        # 'any-any' is redundant with 'any', but dpkg-architecture supports
#.........这里部分代码省略.........
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:103,代码来源:test_buildarch.py


注:本文中的lp.soyuz.tests.test_publishing.SoyuzTestPublisher.prepareBreezyAutotest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。