當前位置: 首頁>>代碼示例>>Python>>正文


Python SoyuzTestPublisher.setUpDefaultDistroSeries方法代碼示例

本文整理匯總了Python中lp.soyuz.tests.test_publishing.SoyuzTestPublisher.setUpDefaultDistroSeries方法的典型用法代碼示例。如果您正苦於以下問題:Python SoyuzTestPublisher.setUpDefaultDistroSeries方法的具體用法?Python SoyuzTestPublisher.setUpDefaultDistroSeries怎麽用?Python SoyuzTestPublisher.setUpDefaultDistroSeries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在lp.soyuz.tests.test_publishing.SoyuzTestPublisher的用法示例。


在下文中一共展示了SoyuzTestPublisher.setUpDefaultDistroSeries方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _prepareMergeCopy

# 需要導入模塊: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 別名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import setUpDefaultDistroSeries [as 別名]
    def _prepareMergeCopy(self):
        """Add a fresher and a new package to ubuntu/hoary.

        This is used to test merge copy functionality."""
        test_publisher = SoyuzTestPublisher()
        ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
        hoary = ubuntu.getSeries('hoary')
        test_publisher.addFakeChroots(hoary)
        test_publisher.setUpDefaultDistroSeries(hoary)
        test_publisher.getPubSource(
            sourcename="new-in-second-round", version="1.0",
            distroseries=hoary, archive=ubuntu.main_archive)
        test_publisher.getPubSource(
            sourcename="alsa-utils", version="2.0", distroseries=hoary,
            archive=ubuntu.main_archive)
        sources = ubuntu.main_archive.getPublishedSources(
            distroseries=hoary, status=self.pending_statuses,
            name=u'alsa-utils')
        for src in sources:
            if src.source_package_version != '2.0':
                src.supersede()
        LaunchpadZopelessLayer.txn.commit()
開發者ID:vitaminmoo,項目名稱:unnaturalcode,代碼行數:24,代碼來源:test_populatearchive.py

示例2: test_can_run_twice

# 需要導入模塊: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 別名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import setUpDefaultDistroSeries [as 別名]
    def test_can_run_twice(self):
        test_publisher = SoyuzTestPublisher()
        distroseries = test_publisher.setUpDefaultDistroSeries()
        distro = distroseries.distribution
        self.factory.makeComponentSelection(
            distroseries=distroseries, component="main")
        self.factory.makeArchive(
            distribution=distro, purpose=ArchivePurpose.PARTNER)
        test_publisher.getPubSource()

        self.setUpForScriptRun(distro)
        self.makeScript(distro).main()
        self.makeScript(distro).main()
開發者ID:pombreda,項目名稱:UnnaturalCodeFork,代碼行數:15,代碼來源:test_publish_ftpmaster.py

示例3: test_publishes_package

# 需要導入模塊: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 別名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import setUpDefaultDistroSeries [as 別名]
    def test_publishes_package(self):
        test_publisher = SoyuzTestPublisher()
        distroseries = test_publisher.setUpDefaultDistroSeries()
        distro = distroseries.distribution
        pub_config = get_pub_config(distro)
        self.factory.makeComponentSelection(
            distroseries=distroseries, component="main")
        self.factory.makeArchive(
            distribution=distro, purpose=ArchivePurpose.PARTNER)
        test_publisher.getPubSource()

        self.setUpForScriptRun(distro)
        self.makeScript(distro).main()

        archive_root = get_archive_root(pub_config)
        dists_root = get_dists_root(pub_config)

        dsc = os.path.join(
            archive_root, 'pool', 'main', 'f', 'foo', 'foo_666.dsc')
        self.assertEqual("I do not care about sources.", file(dsc).read())
        overrides = os.path.join(
            archive_root + '-overrides', distroseries.name + '_main_source')
        self.assertEqual(dsc, file(overrides).read().rstrip())
        self.assertTrue(path_exists(
            dists_root, distroseries.name, 'main', 'source', 'Sources.gz'))
        self.assertTrue(path_exists(
            dists_root, distroseries.name, 'main', 'source', 'Sources.bz2'))

        distcopyseries = os.path.join(dists_root, distroseries.name)
        release = self.readReleaseFile(
            os.path.join(distcopyseries, "Release"))
        self.assertEqual(distro.displayname, release['Origin'])
        self.assertEqual(distro.displayname, release['Label'])
        self.assertEqual(distroseries.name, release['Suite'])
        self.assertEqual(distroseries.name, release['Codename'])
        self.assertEqual("main", release['Components'])
        self.assertEqual("", release["Architectures"])
        self.assertIn("Date", release)
        self.assertIn("Description", release)
        self.assertNotEqual("", release["MD5Sum"])
        self.assertNotEqual("", release["SHA1"])
        self.assertNotEqual("", release["SHA256"])

        main_release = self.readReleaseFile(
            os.path.join(distcopyseries, 'main', 'source', "Release"))
        self.assertEqual(distroseries.name, main_release["Archive"])
        self.assertEqual("main", main_release["Component"])
        self.assertEqual(distro.displayname, main_release["Origin"])
        self.assertEqual(distro.displayname, main_release["Label"])
        self.assertEqual("source", main_release["Architecture"])
開發者ID:pombreda,項目名稱:UnnaturalCodeFork,代碼行數:52,代碼來源:test_publish_ftpmaster.py

示例4: setUp

# 需要導入模塊: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 別名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import setUpDefaultDistroSeries [as 別名]
 def setUp(self):
     super(TestDistroSourcePackageReleaseFiles, self).setUp()
     # The package must be published for the page to render.
     stp = SoyuzTestPublisher()
     distroseries = stp.setUpDefaultDistroSeries()
     naked_distroseries = remove_security_proxy_and_shout_at_engineer(
         distroseries)
     # XXX Abel Deuring, 2010-07-21, bug 608240. This is scary. But
     # if we use distroseries.distribution instead,
     # test_spr_files_deleted() and test_spr_files_one() fail.
     distro = naked_distroseries.distribution
     source_package_release = stp.getPubSource().sourcepackagerelease
     self.dspr = DistributionSourcePackageRelease(
         distro, source_package_release)
     self.library_file = self.factory.makeLibraryFileAlias(
         filename='test_file.dsc', content='0123456789')
     source_package_release.addFile(self.library_file)
開發者ID:pombreda,項目名稱:UnnaturalCodeFork,代碼行數:19,代碼來源:test_distrosourcepackagerelease.py

示例5: test_script_creates_indexes

# 需要導入模塊: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 別名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import setUpDefaultDistroSeries [as 別名]
 def test_script_creates_indexes(self):
     # End-to-end test: the script creates indexes for distroseries
     # that need them.
     test_publisher = SoyuzTestPublisher()
     series = test_publisher.setUpDefaultDistroSeries()
     series.status = SeriesStatus.FROZEN
     self.factory.makeComponentSelection(
         distroseries=series, component="main")
     self.layer.txn.commit()
     self.setUpForScriptRun(series.distribution)
     script = self.makeScript(series.distribution)
     script.main()
     self.assertEqual([], script.listSuitesNeedingIndexes(series))
     sources = os.path.join(
         getPubConfig(series.main_archive).distsroot,
         series.name, "main", "source", "Sources")
     self.assertTrue(file_exists(sources))
開發者ID:pombreda,項目名稱:UnnaturalCodeFork,代碼行數:19,代碼來源:test_publish_ftpmaster.py

示例6: getTestPublisher

# 需要導入模塊: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 別名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import setUpDefaultDistroSeries [as 別名]
 def getTestPublisher(self, distroseries):
     """Return an `SoyuzTestPublisher`instance."""
     stp = SoyuzTestPublisher()
     stp.addFakeChroots(distroseries)
     stp.setUpDefaultDistroSeries(distroseries)
     return stp
開發者ID:pombreda,項目名稱:UnnaturalCodeFork,代碼行數:8,代碼來源:test_deathrow.py

示例7: setUp

# 需要導入模塊: from lp.soyuz.tests.test_publishing import SoyuzTestPublisher [as 別名]
# 或者: from lp.soyuz.tests.test_publishing.SoyuzTestPublisher import setUpDefaultDistroSeries [as 別名]
class CurrentSourceReleasesMixin:
    """Mixin class for current source release tests.

    Used by tests of DistroSeries and Distribution.  The mixin must not extend
    TestCase or it will be run by other modules when imported.
    """
    def setUp(self):
        # Log in as an admin, so that we can create distributions.
        super(CurrentSourceReleasesMixin, self).setUp()
        login('[email protected]')
        self.publisher = SoyuzTestPublisher()
        self.factory = self.publisher.factory
        self.development_series = self.publisher.setUpDefaultDistroSeries()
        self.distribution = self.development_series.distribution
        self.published_package = self.target.getSourcePackage(
            self.publisher.default_package_name)
        login(ANONYMOUS)

    def assertCurrentVersion(self, expected_version, package_name=None):
        """Assert the current version of a package is the expected one.

        It uses getCurrentSourceReleases() to get the version.

        If package_name isn't specified, the test publisher's default
        name is used.
        """
        if package_name is None:
            package_name = self.publisher.default_package_name
        package = self.target.getSourcePackage(package_name)
        releases = self.target.getCurrentSourceReleases(
            [package.sourcepackagename])
        self.assertEqual(releases[package].version, expected_version)

    def test_one_release(self):
        # If there is one published version, that one will be returned.
        self.publisher.getPubSource(version='0.9')
        self.assertCurrentVersion('0.9')

    def test_return_value(self):
        # getCurrentSourceReleases() returns a dict. The corresponding
        # source package is used as the key, with
        # a DistroSeriesSourcePackageRelease as the values.
        self.publisher.getPubSource(version='0.9')
        releases = self.target.getCurrentSourceReleases(
            [self.published_package.sourcepackagename])
        self.assertTrue(self.published_package in releases)
        self.assertTrue(self.release_interface.providedBy(
            releases[self.published_package]))

    def test_latest_version(self):
        # If more than one version is published, the latest one is
        # returned.
        self.publisher.getPubSource(version='0.9')
        self.publisher.getPubSource(version='1.0')
        self.assertCurrentVersion('1.0')

    def test_active_publishing_status(self):
        # Every status defined in active_publishing_status is considered
        # when checking for the current release.
        self.publisher.getPubSource(version='0.9')
        for minor_version, status in enumerate(active_publishing_status):
            latest_version = '1.%s' % minor_version
            self.publisher.getPubSource(version=latest_version, status=status)
            self.assertCurrentVersion(latest_version)

    def test_not_active_publishing_status(self):
        # Every status not defined in active_publishing_status is
        # ignored when checking for the current release.
        self.publisher.getPubSource(version='0.9')
        for minor_version, status in enumerate(PackagePublishingStatus.items):
            if status in active_publishing_status:
                continue
            self.publisher.getPubSource(
                version='1.%s' % minor_version, status=status)
            self.assertCurrentVersion('0.9')

    def test_ignore_other_package_names(self):
        # Packages with different names don't affect the returned
        # version.
        self.publisher.getPubSource(version='0.9', sourcename='foo')
        self.publisher.getPubSource(version='1.0', sourcename='bar')
        self.assertCurrentVersion('0.9', package_name='foo')

    def ignore_other_distributions(self):
        # Packages with the same name in other distributions don't
        # affect the returned version.
        series_in_other_distribution = self.factory.makeDistroSeries()
        self.publisher.getPubSource(version='0.9')
        self.publisher.getPubSource(
            version='1.0', distroseries=series_in_other_distribution)
        self.assertCurrentVersion('0.9')

    def test_ignore_ppa(self):
        # PPA packages having the same name don't affect the returned
        # version.
        ppa_uploader = self.factory.makePerson()
        ppa_archive = getUtility(IArchiveSet).new(
            purpose=ArchivePurpose.PPA, owner=ppa_uploader,
            distribution=self.distribution)
        self.publisher.getPubSource(version='0.9')
#.........這裏部分代碼省略.........
開發者ID:pombreda,項目名稱:UnnaturalCodeFork,代碼行數:103,代碼來源:test_distroseries.py


注:本文中的lp.soyuz.tests.test_publishing.SoyuzTestPublisher.setUpDefaultDistroSeries方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。