本文整理汇总了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()
示例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()
示例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"])
示例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)
示例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))
示例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
示例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')
#.........这里部分代码省略.........