Merge lp:~james-w/launchpad/improve-makeDistroArchSeries into lp:launchpad

Proposed by James Westby
Status: Work in progress
Proposed branch: lp:~james-w/launchpad/improve-makeDistroArchSeries
Merge into: lp:launchpad
Prerequisite: lp:~james-w/launchpad/no-more-sampledata-2
Diff against target: 100 lines (+29/-10)
5 files modified
lib/lp/soyuz/interfaces/distroarchseries.py (+0/-3)
lib/lp/soyuz/model/distroarchseries.py (+0/-5)
lib/lp/soyuz/tests/test_publishing.py (+1/-1)
lib/lp/testing/factory.py (+3/-1)
lib/lp/testing/tests/test_factory.py (+25/-0)
To merge this branch: bzr merge lp:~james-w/launchpad/improve-makeDistroArchSeries
Reviewer Review Type Date Requested Status
Jonathan Lange (community) Approve
Review via email: mp+31910@code.launchpad.net

Commit message

makeDistroArchSeries now creates a new ProcessorFamily and ensures that it has at least one processor.

Description of the change

Hi,

A small change around makeDistroArchSeries:

  1. Test the method.
  2. remove an unused attribute that prevents verifyObject from passing.
  3. Have the method create a ProcessorFamily rather than using sampledata, and ensure there is at least one processor in that family.

Thanks,

James

To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote :

Thanks so much !

review: Approve
11320. By James Westby

Merged no-more-sampledata-2 into improve-makeDistroArchSeries.

11321. By James Westby

Merged no-more-sampledata-2 into improve-makeDistroArchSeries.

11322. By James Westby

Remove the unused component from the parameters.

11323. By James Westby

Merged no-more-sampledata-2 into improve-makeDistroArchSeries.

11324. By James Westby

Merge no-more-sampledata-2 in to improve-makeDistroArchSeries.

Unmerged revisions

11324. By James Westby

Merge no-more-sampledata-2 in to improve-makeDistroArchSeries.

11323. By James Westby

Merged no-more-sampledata-2 into improve-makeDistroArchSeries.

11322. By James Westby

Remove the unused component from the parameters.

11321. By James Westby

Merged no-more-sampledata-2 into improve-makeDistroArchSeries.

11320. By James Westby

Merged no-more-sampledata-2 into improve-makeDistroArchSeries.

11319. By James Westby

This improves makeDistroArchSeries, having it create a ProcessorFamily.

It also drops a badly implemented and unused attribute from DistroArchSeries.

11318. By James Westby

Merged soyuz-factory-improvements into no-more-sampledata-2.

11317. By James Westby

Clean up lint.

11316. By James Westby

Fix a mistaken change.

11315. By James Westby

Undo the layer change as it is no longer needed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/interfaces/distroarchseries.py'
2--- lib/lp/soyuz/interfaces/distroarchseries.py 2010-02-20 02:37:49 +0000
3+++ lib/lp/soyuz/interfaces/distroarchseries.py 2010-08-16 22:09:54 +0000
4@@ -74,9 +74,6 @@
5 "for building PPA packages."),
6 required=False))
7
8- # Joins.
9- packages = Attribute('List of binary packages in this port.')
10-
11 # Page layouts helpers.
12 title = exported(
13 TextLine(
14
15=== modified file 'lib/lp/soyuz/model/distroarchseries.py'
16--- lib/lp/soyuz/model/distroarchseries.py 2010-08-10 05:10:16 +0000
17+++ lib/lp/soyuz/model/distroarchseries.py 2010-08-16 22:09:54 +0000
18@@ -62,11 +62,6 @@
19 package_count = IntCol(notNull=True, default=DEFAULT)
20 supports_virtualized = BoolCol(notNull=False, default=False)
21
22- packages = SQLRelatedJoin('BinaryPackageRelease',
23- joinColumn='distroarchseries',
24- intermediateTable='BinaryPackagePublishing',
25- otherColumn='binarypackagerelease')
26-
27 def __getitem__(self, name):
28 return self.getBinaryPackage(name)
29
30
31=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
32--- lib/lp/soyuz/tests/test_publishing.py 2010-08-16 22:09:53 +0000
33+++ lib/lp/soyuz/tests/test_publishing.py 2010-08-16 22:09:54 +0000
34@@ -406,7 +406,7 @@
35 status=PackagePublishingStatus.PENDING,
36 pocket=PackagePublishingPocket.RELEASE,
37 scheduleddeletiondate=None, dateremoved=None, section=None,
38- priority=None, component=None):
39+ priority=None):
40 """Return the corresponding BinaryPackagePublishingHistory."""
41 distroarchseries = binarypackagerelease.build.distro_arch_series
42
43
44=== modified file 'lib/lp/testing/factory.py'
45--- lib/lp/testing/factory.py 2010-08-16 22:09:53 +0000
46+++ lib/lp/testing/factory.py 2010-08-16 22:09:54 +0000
47@@ -1728,7 +1728,9 @@
48 if distroseries is None:
49 distroseries = self.makeDistroRelease()
50 if processorfamily is None:
51- processorfamily = ProcessorFamilySet().getByName('powerpc')
52+ processorfamily = self.makeProcessorFamily()
53+ if not processorfamily.processors:
54+ self.makeProcessor(family=processorfamily)
55 if owner is None:
56 owner = self.makePerson()
57 if architecturetag is None:
58
59=== modified file 'lib/lp/testing/tests/test_factory.py'
60--- lib/lp/testing/tests/test_factory.py 2010-08-16 22:09:53 +0000
61+++ lib/lp/testing/tests/test_factory.py 2010-08-16 22:09:54 +0000
62@@ -26,6 +26,7 @@
63 from lp.soyuz.interfaces.binarypackagename import IBinaryPackageName
64 from lp.soyuz.interfaces.binarypackagerelease import (
65 BinaryPackageFileType, BinaryPackageFormat, IBinaryPackageRelease)
66+from lp.soyuz.interfaces.distroarchseries import IDistroArchSeries
67 from lp.soyuz.interfaces.files import (
68 IBinaryPackageFile, ISourcePackageReleaseFile)
69 from lp.soyuz.interfaces.publishing import (
70@@ -339,6 +340,30 @@
71 distribution = self.factory.makeDistribution()
72 self.assertThat(distribution.displayname, StartsWith("Distribution"))
73
74+ # makeDistroArchSeries
75+ def test_makeDistroArchSeries_returns_proxied_IDistroArchSeries(self):
76+ das = self.factory.makeDistroArchSeries()
77+ self.assertThat(das, ProvidesAndIsProxied(IDistroArchSeries))
78+
79+ def test_makeDistroArchSeries_makes_ProcessorFamily(self):
80+ das1 = self.factory.makeDistroArchSeries()
81+ das2 = self.factory.makeDistroArchSeries()
82+ self.assertNotEqual(das1.processorfamily, das2.processorfamily)
83+
84+ def test_makeDistroArchSeries_uses_processorfamily(self):
85+ family = self.factory.makeProcessorFamily()
86+ das = self.factory.makeDistroArchSeries(processorfamily=family)
87+ self.assertEqual(family, das.processorfamily)
88+
89+ def test_makeDistroArchSeries_has_a_processor(self):
90+ das = self.factory.makeDistroArchSeries()
91+ self.assertNotEqual([], das.processorfamily.processors)
92+
93+ def test_makeDistroArchSeries_makes_a_processor_for_existing_family(self):
94+ family = self.factory.makeProcessorFamily()
95+ das = self.factory.makeDistroArchSeries(processorfamily=family)
96+ self.assertNotEqual([], das.processorfamily.processors)
97+
98 # makeDistroRelease
99 def test_makeDistroRelease_returns_IDistroSeries(self):
100 distroseries = self.factory.makeDistroRelease()