Merge lp:~jtv/launchpad/test-cruft-soyuz into lp:launchpad
- test-cruft-soyuz
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Robert Collins |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11184 |
Proposed branch: | lp:~jtv/launchpad/test-cruft-soyuz |
Merge into: | lp:launchpad |
Diff against target: |
1781 lines (+173/-350) 38 files modified
lib/lp/soyuz/browser/tests/test_archive_packages.py (+0/-5) lib/lp/soyuz/browser/tests/test_breadcrumbs.py (+5/-8) lib/lp/soyuz/browser/tests/test_distrosourcepackagerelease.py (+0/-6) lib/lp/soyuz/browser/tests/test_queue.py (+0/-5) lib/lp/soyuz/browser/tests/test_sourcepackagerelease.py (+0/-5) lib/lp/soyuz/browser/tests/test_sourceslistentries.py (+2/-6) lib/lp/soyuz/scripts/tests/test_archivecruftchecker.py (+5/-11) lib/lp/soyuz/scripts/tests/test_buildd_cronscripts.py (+5/-9) lib/lp/soyuz/scripts/tests/test_changeoverride.py (+1/-5) lib/lp/soyuz/scripts/tests/test_chrootmanager.py (+2/-6) lib/lp/soyuz/scripts/tests/test_copypackage.py (+4/-9) lib/lp/soyuz/scripts/tests/test_expire_archive_files.py (+4/-8) lib/lp/soyuz/scripts/tests/test_gina.py (+1/-2) lib/lp/soyuz/scripts/tests/test_lpquerydistro.py (+3/-7) lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py (+7/-10) lib/lp/soyuz/scripts/tests/test_overrides_checker.py (+3/-8) lib/lp/soyuz/scripts/tests/test_populatearchive.py (+14/-19) lib/lp/soyuz/scripts/tests/test_ppa_apache_log_parser.py (+0/-5) lib/lp/soyuz/scripts/tests/test_ppakeygenerator.py (+16/-37) lib/lp/soyuz/scripts/tests/test_ppareport.py (+16/-31) lib/lp/soyuz/scripts/tests/test_processdeathrow.py (+2/-6) lib/lp/soyuz/scripts/tests/test_processpendingpackagediffs.py (+1/-7) lib/lp/soyuz/scripts/tests/test_processupload.py (+7/-11) lib/lp/soyuz/tests/test_archive.py (+21/-24) lib/lp/soyuz/tests/test_archive_agent.py (+0/-1) lib/lp/soyuz/tests/test_archive_privacy.py (+0/-1) lib/lp/soyuz/tests/test_archive_subscriptions.py (+1/-8) lib/lp/soyuz/tests/test_archivearch.py (+3/-8) lib/lp/soyuz/tests/test_binarypackagebuild.py (+3/-10) lib/lp/soyuz/tests/test_distroseriesbinarypackage.py (+0/-5) lib/lp/soyuz/tests/test_hasbuildrecords.py (+7/-7) lib/lp/soyuz/tests/test_packagediff.py (+0/-5) lib/lp/soyuz/tests/test_packageupload.py (+1/-6) lib/lp/soyuz/tests/test_publish_archive_indexes.py (+9/-9) lib/lp/soyuz/tests/test_publishing.py (+11/-14) lib/lp/soyuz/tests/test_publishing_models.py (+3/-8) lib/lp/soyuz/tests/test_publishing_top_level_api.py (+13/-18) lib/lp/testing/faketransaction.py (+3/-0) |
To merge this branch: | bzr merge lp:~jtv/launchpad/test-cruft-soyuz |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Leonard Richardson (community) | code | Approve | |
Review via email: mp+30407@code.launchpad.net |
Commit message
Soyuz test cruft.
Description of the change
= Soyuz test cruft =
This gives the Soyuz tests some much-needed love. Tough love, but still. To give an impression of how much it was needed, the branch is vastly oversized, for which I apologize with few regrets.
You'll find 3 types of changes here:
1. Removed boilerplate.
Unit tests used to need some boilerplate at the end that is not dead wood.
2. Lint fixes.
As every true Launchpad engineer would, I ran "make lint" over the changes and cleaned up a few problems. This is the majority of the diff.
3. Reuse fake classes from lp.testing.
I substituted FakeMethod and FakeTransaction for ad-hoc equivalents I found in the tests. I extended FakeTransaction with a commit count to satisfy one of the use cases.
To test:
{{{
./bin/test -vvc -m lp.soyuz
}}}
Set apart some time for this.
Jeroen
Preview Diff
1 | === modified file 'lib/lp/soyuz/browser/tests/test_archive_packages.py' | |||
2 | --- lib/lp/soyuz/browser/tests/test_archive_packages.py 2010-06-24 14:16:42 +0000 | |||
3 | +++ lib/lp/soyuz/browser/tests/test_archive_packages.py 2010-07-21 07:48:48 +0000 | |||
4 | @@ -12,8 +12,6 @@ | |||
5 | 12 | 'test_suite', | 12 | 'test_suite', |
6 | 13 | ] | 13 | ] |
7 | 14 | 14 | ||
8 | 15 | import unittest | ||
9 | 16 | |||
10 | 17 | from zope.security.interfaces import Unauthorized | 15 | from zope.security.interfaces import Unauthorized |
11 | 18 | 16 | ||
12 | 19 | from canonical.testing import LaunchpadFunctionalLayer | 17 | from canonical.testing import LaunchpadFunctionalLayer |
13 | @@ -96,6 +94,3 @@ | |||
14 | 96 | view = create_initialized_view(self.ppa, "+index") | 94 | view = create_initialized_view(self.ppa, "+index") |
15 | 97 | menu = ArchiveNavigationMenu(view) | 95 | menu = ArchiveNavigationMenu(view) |
16 | 98 | self.assertTrue(menu.packages().enabled) | 96 | self.assertTrue(menu.packages().enabled) |
17 | 99 | |||
18 | 100 | def test_suite(): | ||
19 | 101 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
20 | 102 | 97 | ||
21 | === modified file 'lib/lp/soyuz/browser/tests/test_breadcrumbs.py' | |||
22 | --- lib/lp/soyuz/browser/tests/test_breadcrumbs.py 2010-04-28 10:26:58 +0000 | |||
23 | +++ lib/lp/soyuz/browser/tests/test_breadcrumbs.py 2010-07-21 07:48:48 +0000 | |||
24 | @@ -1,10 +1,8 @@ | |||
26 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
27 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
28 | 3 | 3 | ||
29 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
30 | 5 | 5 | ||
31 | 6 | import unittest | ||
32 | 7 | |||
33 | 8 | from zope.component import getUtility | 6 | from zope.component import getUtility |
34 | 9 | 7 | ||
35 | 10 | from canonical.launchpad.webapp.publisher import canonical_url | 8 | from canonical.launchpad.webapp.publisher import canonical_url |
36 | @@ -65,9 +63,8 @@ | |||
37 | 65 | 63 | ||
38 | 66 | def test_personal_archive_subscription(self): | 64 | def test_personal_archive_subscription(self): |
39 | 67 | subscription_url = canonical_url(self.personal_archive_subscription) | 65 | subscription_url = canonical_url(self.personal_archive_subscription) |
41 | 68 | crumbs = self.getBreadcrumbsForObject(self.personal_archive_subscription) | 66 | crumbs = self.getBreadcrumbsForObject( |
42 | 67 | self.personal_archive_subscription) | ||
43 | 69 | self.assertEquals(subscription_url, crumbs[-1].url) | 68 | self.assertEquals(subscription_url, crumbs[-1].url) |
48 | 70 | self.assertEquals("Access to %s" % self.ppa.displayname, crumbs[-1].text) | 69 | self.assertEquals( |
49 | 71 | 70 | "Access to %s" % self.ppa.displayname, crumbs[-1].text) | |
46 | 72 | def test_suite(): | ||
47 | 73 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
50 | 74 | 71 | ||
51 | === modified file 'lib/lp/soyuz/browser/tests/test_distrosourcepackagerelease.py' | |||
52 | --- lib/lp/soyuz/browser/tests/test_distrosourcepackagerelease.py 2010-07-06 11:52:17 +0000 | |||
53 | +++ lib/lp/soyuz/browser/tests/test_distrosourcepackagerelease.py 2010-07-21 07:48:48 +0000 | |||
54 | @@ -7,8 +7,6 @@ | |||
55 | 7 | 7 | ||
56 | 8 | __metaclass__ = type | 8 | __metaclass__ = type |
57 | 9 | 9 | ||
58 | 10 | import unittest | ||
59 | 11 | |||
60 | 12 | from zope.security.proxy import removeSecurityProxy | 10 | from zope.security.proxy import removeSecurityProxy |
61 | 13 | 11 | ||
62 | 14 | from canonical.testing import LaunchpadFunctionalLayer | 12 | from canonical.testing import LaunchpadFunctionalLayer |
63 | @@ -49,7 +47,3 @@ | |||
64 | 49 | view = create_initialized_view(self.dspr, "+index") | 47 | view = create_initialized_view(self.dspr, "+index") |
65 | 50 | html = view.__call__() | 48 | html = view.__call__() |
66 | 51 | self.failUnless('test_file.dsc (deleted)' in html) | 49 | self.failUnless('test_file.dsc (deleted)' in html) |
67 | 52 | |||
68 | 53 | |||
69 | 54 | def test_suite(): | ||
70 | 55 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
71 | 56 | 50 | ||
72 | === modified file 'lib/lp/soyuz/browser/tests/test_queue.py' | |||
73 | --- lib/lp/soyuz/browser/tests/test_queue.py 2010-03-09 15:33:12 +0000 | |||
74 | +++ lib/lp/soyuz/browser/tests/test_queue.py 2010-07-21 07:48:48 +0000 | |||
75 | @@ -10,7 +10,6 @@ | |||
76 | 10 | ] | 10 | ] |
77 | 11 | 11 | ||
78 | 12 | import transaction | 12 | import transaction |
79 | 13 | import unittest | ||
80 | 14 | from zope.component import getUtility, queryMultiAdapter | 13 | from zope.component import getUtility, queryMultiAdapter |
81 | 15 | 14 | ||
82 | 16 | from canonical.launchpad.webapp.servers import LaunchpadTestRequest | 15 | from canonical.launchpad.webapp.servers import LaunchpadTestRequest |
83 | @@ -185,7 +184,3 @@ | |||
84 | 185 | self.assertEquals( | 184 | self.assertEquals( |
85 | 186 | 'NEW', | 185 | 'NEW', |
86 | 187 | getUtility(IPackageUploadSet).get(package_upload_id).status.name) | 186 | getUtility(IPackageUploadSet).get(package_upload_id).status.name) |
87 | 188 | |||
88 | 189 | def test_suite(): | ||
89 | 190 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
90 | 191 | |||
91 | 192 | 187 | ||
92 | === modified file 'lib/lp/soyuz/browser/tests/test_sourcepackagerelease.py' | |||
93 | --- lib/lp/soyuz/browser/tests/test_sourcepackagerelease.py 2010-07-02 17:51:33 +0000 | |||
94 | +++ lib/lp/soyuz/browser/tests/test_sourcepackagerelease.py 2010-07-21 07:48:48 +0000 | |||
95 | @@ -11,8 +11,6 @@ | |||
96 | 11 | 'test_suite', | 11 | 'test_suite', |
97 | 12 | ] | 12 | ] |
98 | 13 | 13 | ||
99 | 14 | import unittest | ||
100 | 15 | |||
101 | 16 | from zope.security.proxy import removeSecurityProxy | 14 | from zope.security.proxy import removeSecurityProxy |
102 | 17 | 15 | ||
103 | 18 | from canonical.testing import ( | 16 | from canonical.testing import ( |
104 | @@ -109,6 +107,3 @@ | |||
105 | 109 | view = create_initialized_view( | 107 | view = create_initialized_view( |
106 | 110 | self.source_package_release, '+copyright') | 108 | self.source_package_release, '+copyright') |
107 | 111 | self.assertEqual(expected, view.highlighted_copyright) | 109 | self.assertEqual(expected, view.highlighted_copyright) |
108 | 112 | |||
109 | 113 | def test_suite(): | ||
110 | 114 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
111 | 115 | 110 | ||
112 | === modified file 'lib/lp/soyuz/browser/tests/test_sourceslistentries.py' | |||
113 | --- lib/lp/soyuz/browser/tests/test_sourceslistentries.py 2009-09-07 14:54:34 +0000 | |||
114 | +++ lib/lp/soyuz/browser/tests/test_sourceslistentries.py 2010-07-21 07:48:48 +0000 | |||
115 | @@ -1,4 +1,4 @@ | |||
117 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
118 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
119 | 3 | 3 | ||
120 | 4 | # pylint: disable-msg=F0401 | 4 | # pylint: disable-msg=F0401 |
121 | @@ -13,8 +13,6 @@ | |||
122 | 13 | 'test_suite', | 13 | 'test_suite', |
123 | 14 | ] | 14 | ] |
124 | 15 | 15 | ||
125 | 16 | import unittest | ||
126 | 17 | |||
127 | 18 | from lp.testing import TestCaseWithFactory | 16 | from lp.testing import TestCaseWithFactory |
128 | 19 | 17 | ||
129 | 20 | from canonical.launchpad.webapp.servers import LaunchpadTestRequest | 18 | from canonical.launchpad.webapp.servers import LaunchpadTestRequest |
130 | @@ -23,6 +21,7 @@ | |||
131 | 23 | from lp.soyuz.browser.sourceslist import ( | 21 | from lp.soyuz.browser.sourceslist import ( |
132 | 24 | SourcesListEntries, SourcesListEntriesView) | 22 | SourcesListEntries, SourcesListEntriesView) |
133 | 25 | 23 | ||
134 | 24 | |||
135 | 26 | class TestDefaultSelectedSeries(TestCaseWithFactory): | 25 | class TestDefaultSelectedSeries(TestCaseWithFactory): |
136 | 27 | """Ensure that default selected series set from user-agent.""" | 26 | """Ensure that default selected series set from user-agent.""" |
137 | 28 | 27 | ||
138 | @@ -166,6 +165,3 @@ | |||
139 | 166 | # When there is only one distro series it should always be the | 165 | # When there is only one distro series it should always be the |
140 | 167 | # default. | 166 | # default. |
141 | 168 | self.failUnless(self.view.default_series == self.series[0]) | 167 | self.failUnless(self.view.default_series == self.series[0]) |
142 | 169 | |||
143 | 170 | def test_suite(): | ||
144 | 171 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
145 | 172 | 168 | ||
146 | === modified file 'lib/lp/soyuz/scripts/tests/test_archivecruftchecker.py' | |||
147 | --- lib/lp/soyuz/scripts/tests/test_archivecruftchecker.py 2009-08-28 06:39:38 +0000 | |||
148 | +++ lib/lp/soyuz/scripts/tests/test_archivecruftchecker.py 2010-07-21 07:48:48 +0000 | |||
149 | @@ -1,4 +1,4 @@ | |||
151 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
152 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
153 | 3 | 3 | ||
154 | 4 | """ArchiveCruftChecker tests. | 4 | """ArchiveCruftChecker tests. |
155 | @@ -25,6 +25,7 @@ | |||
156 | 25 | from canonical.launchpad.scripts.logger import QuietFakeLogger | 25 | from canonical.launchpad.scripts.logger import QuietFakeLogger |
157 | 26 | from canonical.testing import LaunchpadZopelessLayer | 26 | from canonical.testing import LaunchpadZopelessLayer |
158 | 27 | 27 | ||
159 | 28 | |||
160 | 28 | # XXX cprov 2006-05-15: {create, remove}TestArchive functions should be | 29 | # XXX cprov 2006-05-15: {create, remove}TestArchive functions should be |
161 | 29 | # moved to the publisher test domain as soon as we have it. | 30 | # moved to the publisher test domain as soon as we have it. |
162 | 30 | def createTestArchive(): | 31 | def createTestArchive(): |
163 | @@ -60,7 +61,6 @@ | |||
164 | 60 | """Clean up test environment and remove the test archive.""" | 61 | """Clean up test environment and remove the test archive.""" |
165 | 61 | removeTestArchive() | 62 | removeTestArchive() |
166 | 62 | 63 | ||
167 | 63 | |||
168 | 64 | def testInitializeSuccess(self): | 64 | def testInitializeSuccess(self): |
169 | 65 | """Test ArchiveCruftChecker initialization process. | 65 | """Test ArchiveCruftChecker initialization process. |
170 | 66 | 66 | ||
171 | @@ -86,8 +86,7 @@ | |||
172 | 86 | # based on the given 'archive_path'. | 86 | # based on the given 'archive_path'. |
173 | 87 | self.assertEqual( | 87 | self.assertEqual( |
174 | 88 | checker.dist_archive, | 88 | checker.dist_archive, |
177 | 89 | '/var/tmp/archive/ubuntutest/dists/breezy-autotest' | 89 | '/var/tmp/archive/ubuntutest/dists/breezy-autotest') |
176 | 90 | ) | ||
178 | 91 | 90 | ||
179 | 92 | # The 'components' dictionary contains all components selected | 91 | # The 'components' dictionary contains all components selected |
180 | 93 | # for the given distroseries organized as: | 92 | # for the given distroseries organized as: |
181 | @@ -111,7 +110,7 @@ | |||
182 | 111 | 'restricted', | 110 | 'restricted', |
183 | 112 | 'restricted/debian-installer', | 111 | 'restricted/debian-installer', |
184 | 113 | 'universe', | 112 | 'universe', |
186 | 114 | 'universe/debian-installer' | 113 | 'universe/debian-installer', |
187 | 115 | ] | 114 | ] |
188 | 116 | self.assertEqual(sorted(checker.components_and_di), expected) | 115 | self.assertEqual(sorted(checker.components_and_di), expected) |
189 | 117 | 116 | ||
190 | @@ -125,8 +124,7 @@ | |||
191 | 125 | 124 | ||
192 | 126 | self.assertEqual( | 125 | self.assertEqual( |
193 | 127 | checker.dist_archive, | 126 | checker.dist_archive, |
196 | 128 | '/var/tmp/archive/ubuntutest/dists/breezy-autotest-security' | 127 | '/var/tmp/archive/ubuntutest/dists/breezy-autotest-security') |
195 | 129 | ) | ||
197 | 130 | 128 | ||
198 | 131 | def testInitializeFailure(self): | 129 | def testInitializeFailure(self): |
199 | 132 | """ArchiveCruftCheck initialization failures. | 130 | """ArchiveCruftCheck initialization failures. |
200 | @@ -149,7 +147,3 @@ | |||
201 | 149 | self.log, distribution_name='ubuntu', suite='breezy-autotest', | 147 | self.log, distribution_name='ubuntu', suite='breezy-autotest', |
202 | 150 | archive_path=self.archive_path) | 148 | archive_path=self.archive_path) |
203 | 151 | self.assertRaises(ArchiveCruftCheckerError, checker.initialize) | 149 | self.assertRaises(ArchiveCruftCheckerError, checker.initialize) |
204 | 152 | |||
205 | 153 | |||
206 | 154 | def test_suite(): | ||
207 | 155 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
208 | 156 | 150 | ||
209 | === modified file 'lib/lp/soyuz/scripts/tests/test_buildd_cronscripts.py' | |||
210 | --- lib/lp/soyuz/scripts/tests/test_buildd_cronscripts.py 2010-05-20 14:28:51 +0000 | |||
211 | +++ lib/lp/soyuz/scripts/tests/test_buildd_cronscripts.py 2010-07-21 07:48:48 +0000 | |||
212 | @@ -1,4 +1,4 @@ | |||
214 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
215 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
216 | 3 | 3 | ||
217 | 4 | """cronscripts/buildd-* tests.""" | 4 | """cronscripts/buildd-* tests.""" |
218 | @@ -149,12 +149,12 @@ | |||
219 | 149 | qb = self.getQueueBuilder(distribution='boing') | 149 | qb = self.getQueueBuilder(distribution='boing') |
220 | 150 | self.assertRaises(LaunchpadScriptFailure, qb.calculateDistroseries) | 150 | self.assertRaises(LaunchpadScriptFailure, qb.calculateDistroseries) |
221 | 151 | 151 | ||
223 | 152 | qb = self.getQueueBuilder(suites=('hoary-test',)) | 152 | qb = self.getQueueBuilder(suites=('hoary-test', )) |
224 | 153 | self.assertRaises(LaunchpadScriptFailure, qb.calculateDistroseries) | 153 | self.assertRaises(LaunchpadScriptFailure, qb.calculateDistroseries) |
225 | 154 | 154 | ||
226 | 155 | # A single valid suite argument results in a list with one | 155 | # A single valid suite argument results in a list with one |
227 | 156 | # distroseries (pockets are completely ignored). | 156 | # distroseries (pockets are completely ignored). |
229 | 157 | qb = self.getQueueBuilder(suites=('warty-security',)) | 157 | qb = self.getQueueBuilder(suites=('warty-security', )) |
230 | 158 | self.assertEqual( | 158 | self.assertEqual( |
231 | 159 | ['warty'], | 159 | ['warty'], |
232 | 160 | [distroseries.name | 160 | [distroseries.name |
233 | @@ -179,7 +179,7 @@ | |||
234 | 179 | # Restricting the build creation to another distroseries | 179 | # Restricting the build creation to another distroseries |
235 | 180 | # does not create any builds. | 180 | # does not create any builds. |
236 | 181 | source = self.getSourceWithoutBuilds() | 181 | source = self.getSourceWithoutBuilds() |
238 | 182 | queue_builder = self.getQueueBuilder(suites=('warty',)) | 182 | queue_builder = self.getQueueBuilder(suites=('warty', )) |
239 | 183 | queue_builder.main() | 183 | queue_builder.main() |
240 | 184 | self.assertEqual(0, len(source.getBuilds())) | 184 | self.assertEqual(0, len(source.getBuilds())) |
241 | 185 | 185 | ||
242 | @@ -187,7 +187,7 @@ | |||
243 | 187 | # A build is created when queue-builder is restricted to the | 187 | # A build is created when queue-builder is restricted to the |
244 | 188 | # distroseries where the testing source is published | 188 | # distroseries where the testing source is published |
245 | 189 | source = self.getSourceWithoutBuilds() | 189 | source = self.getSourceWithoutBuilds() |
247 | 190 | queue_builder = self.getQueueBuilder(suites=('hoary',)) | 190 | queue_builder = self.getQueueBuilder(suites=('hoary', )) |
248 | 191 | queue_builder.main() | 191 | queue_builder.main() |
249 | 192 | self.assertEqual(1, len(source.getBuilds())) | 192 | self.assertEqual(1, len(source.getBuilds())) |
250 | 193 | 193 | ||
251 | @@ -303,7 +303,3 @@ | |||
252 | 303 | self.getPendingBuilds().count()) | 303 | self.getPendingBuilds().count()) |
253 | 304 | self.assertEqual(depwait_build.status.name, 'NEEDSBUILD') | 304 | self.assertEqual(depwait_build.status.name, 'NEEDSBUILD') |
254 | 305 | self.assertEqual(depwait_build.buildqueue_record.lastscore, 1755) | 305 | self.assertEqual(depwait_build.buildqueue_record.lastscore, 1755) |
255 | 306 | |||
256 | 307 | |||
257 | 308 | def test_suite(): | ||
258 | 309 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
259 | 310 | 306 | ||
260 | === modified file 'lib/lp/soyuz/scripts/tests/test_changeoverride.py' | |||
261 | --- lib/lp/soyuz/scripts/tests/test_changeoverride.py 2009-08-28 07:34:44 +0000 | |||
262 | +++ lib/lp/soyuz/scripts/tests/test_changeoverride.py 2010-07-21 07:48:48 +0000 | |||
263 | @@ -1,4 +1,4 @@ | |||
265 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
266 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
267 | 3 | 3 | ||
268 | 4 | """`ChangeOverride` script class tests.""" | 4 | """`ChangeOverride` script class tests.""" |
269 | @@ -517,7 +517,3 @@ | |||
270 | 517 | SoyuzScriptError, changer.processBinaryChange, 'biscuit') | 517 | SoyuzScriptError, changer.processBinaryChange, 'biscuit') |
271 | 518 | self.assertRaises( | 518 | self.assertRaises( |
272 | 519 | SoyuzScriptError, changer.processChildrenChange, 'cookie') | 519 | SoyuzScriptError, changer.processChildrenChange, 'cookie') |
273 | 520 | |||
274 | 521 | |||
275 | 522 | def test_suite(): | ||
276 | 523 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
277 | 524 | 520 | ||
278 | === modified file 'lib/lp/soyuz/scripts/tests/test_chrootmanager.py' | |||
279 | --- lib/lp/soyuz/scripts/tests/test_chrootmanager.py 2009-06-25 04:06:00 +0000 | |||
280 | +++ lib/lp/soyuz/scripts/tests/test_chrootmanager.py 2010-07-21 07:48:48 +0000 | |||
281 | @@ -1,11 +1,11 @@ | |||
283 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
284 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
285 | 3 | 3 | ||
286 | 4 | """ChrootManager facilities tests.""" | 4 | """ChrootManager facilities tests.""" |
287 | 5 | 5 | ||
288 | 6 | __metaclass__ = type | 6 | __metaclass__ = type |
289 | 7 | 7 | ||
291 | 8 | from unittest import TestCase, TestLoader | 8 | from unittest import TestCase |
292 | 9 | import os | 9 | import os |
293 | 10 | import re | 10 | import re |
294 | 11 | import tempfile | 11 | import tempfile |
295 | @@ -157,7 +157,3 @@ | |||
296 | 157 | 157 | ||
297 | 158 | self.assertRaises( | 158 | self.assertRaises( |
298 | 159 | ChrootManagerError, chroot_manager.add) | 159 | ChrootManagerError, chroot_manager.add) |
299 | 160 | |||
300 | 161 | |||
301 | 162 | def test_suite(): | ||
302 | 163 | return TestLoader().loadTestsFromName(__name__) | ||
303 | 164 | 160 | ||
304 | === modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py' | |||
305 | --- lib/lp/soyuz/scripts/tests/test_copypackage.py 2010-05-26 08:54:17 +0000 | |||
306 | +++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2010-07-21 07:48:48 +0000 | |||
307 | @@ -1,4 +1,4 @@ | |||
309 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
310 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
311 | 3 | 3 | ||
312 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
313 | @@ -1352,8 +1352,7 @@ | |||
314 | 1352 | self.assertEqual( | 1352 | self.assertEqual( |
315 | 1353 | sorted(copied_ids), sorted(pending_ids), | 1353 | sorted(copied_ids), sorted(pending_ids), |
316 | 1354 | "The copy did not succeed.\nExpected IDs: %s\nFound IDs: %s" % ( | 1354 | "The copy did not succeed.\nExpected IDs: %s\nFound IDs: %s" % ( |
319 | 1355 | sorted(copied_ids), sorted(pending_ids)) | 1355 | sorted(copied_ids), sorted(pending_ids))) |
318 | 1356 | ) | ||
320 | 1357 | 1356 | ||
321 | 1358 | def testCopyBetweenDistroSeries(self): | 1357 | def testCopyBetweenDistroSeries(self): |
322 | 1359 | """Check the copy operation between distroseries.""" | 1358 | """Check the copy operation between distroseries.""" |
323 | @@ -2275,7 +2274,7 @@ | |||
324 | 2275 | "--ppa", "joe", | 2274 | "--ppa", "joe", |
325 | 2276 | "--ppa-name", "ppa", | 2275 | "--ppa-name", "ppa", |
326 | 2277 | "-s", "%s" % ppa_source.distroseries.name + "-security", | 2276 | "-s", "%s" % ppa_source.distroseries.name + "-security", |
328 | 2278 | "foo" | 2277 | "foo", |
329 | 2279 | ] | 2278 | ] |
330 | 2280 | 2279 | ||
331 | 2281 | script = UnembargoSecurityPackage( | 2280 | script = UnembargoSecurityPackage( |
332 | @@ -2324,7 +2323,7 @@ | |||
333 | 2324 | test_args = [ | 2323 | test_args = [ |
334 | 2325 | "--ppa", "cprov", | 2324 | "--ppa", "cprov", |
335 | 2326 | "-s", "warty-backports", | 2325 | "-s", "warty-backports", |
337 | 2327 | "foo" | 2326 | "foo", |
338 | 2328 | ] | 2327 | ] |
339 | 2329 | 2328 | ||
340 | 2330 | script = UnembargoSecurityPackage( | 2329 | script = UnembargoSecurityPackage( |
341 | @@ -2641,7 +2640,3 @@ | |||
342 | 2641 | None, | 2640 | None, |
343 | 2642 | checker.checkCopy(test2_source, warty, | 2641 | checker.checkCopy(test2_source, warty, |
344 | 2643 | PackagePublishingPocket.RELEASE)) | 2642 | PackagePublishingPocket.RELEASE)) |
345 | 2644 | |||
346 | 2645 | |||
347 | 2646 | def test_suite(): | ||
348 | 2647 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
349 | 2648 | 2643 | ||
350 | === modified file 'lib/lp/soyuz/scripts/tests/test_expire_archive_files.py' | |||
351 | --- lib/lp/soyuz/scripts/tests/test_expire_archive_files.py 2010-03-10 11:13:55 +0000 | |||
352 | +++ lib/lp/soyuz/scripts/tests/test_expire_archive_files.py 2010-07-21 07:48:48 +0000 | |||
353 | @@ -1,11 +1,10 @@ | |||
355 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
356 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
357 | 3 | 3 | ||
358 | 4 | """Test the expire-archive-files.py script. """ | 4 | """Test the expire-archive-files.py script. """ |
359 | 5 | 5 | ||
360 | 6 | from datetime import datetime, timedelta | 6 | from datetime import datetime, timedelta |
361 | 7 | import pytz | 7 | import pytz |
362 | 8 | import unittest | ||
363 | 9 | 8 | ||
364 | 10 | from zope.component import getUtility | 9 | from zope.component import getUtility |
365 | 11 | 10 | ||
366 | @@ -99,9 +98,10 @@ | |||
367 | 99 | 98 | ||
368 | 100 | class ArchiveExpiryCommonTests(object): | 99 | class ArchiveExpiryCommonTests(object): |
369 | 101 | """Common source/binary expiration test cases. | 100 | """Common source/binary expiration test cases. |
371 | 102 | 101 | ||
372 | 103 | These will be shared irrespective of archive type (ppa/partner). | 102 | These will be shared irrespective of archive type (ppa/partner). |
373 | 104 | """ | 103 | """ |
374 | 104 | |||
375 | 105 | def testNoExpirationWithNoDateremoved(self): | 105 | def testNoExpirationWithNoDateremoved(self): |
376 | 106 | """Test that no expiring happens if no dateremoved set.""" | 106 | """Test that no expiring happens if no dateremoved set.""" |
377 | 107 | pkg1 = self.stp.getPubSource( | 107 | pkg1 = self.stp.getPubSource( |
378 | @@ -216,7 +216,7 @@ | |||
379 | 216 | 216 | ||
380 | 217 | class TestPPAExpiry(ArchiveExpiryTestBase, ArchiveExpiryCommonTests): | 217 | class TestPPAExpiry(ArchiveExpiryTestBase, ArchiveExpiryCommonTests): |
381 | 218 | """Test the expire-archive-files.py script. | 218 | """Test the expire-archive-files.py script. |
383 | 219 | 219 | ||
384 | 220 | Here we make use of the common test cases defined in the base class but | 220 | Here we make use of the common test cases defined in the base class but |
385 | 221 | also add tests specific to PPAs (excluding particular PPAs from expiry | 221 | also add tests specific to PPAs (excluding particular PPAs from expiry |
386 | 222 | based on a "black list" or on the fact that PPA is private). | 222 | based on a "black list" or on the fact that PPA is private). |
387 | @@ -262,7 +262,3 @@ | |||
388 | 262 | purpose=ArchivePurpose.PARTNER) | 262 | purpose=ArchivePurpose.PARTNER) |
389 | 263 | self.archive2 = self.factory.makeArchive( | 263 | self.archive2 = self.factory.makeArchive( |
390 | 264 | purpose=ArchivePurpose.PARTNER) | 264 | purpose=ArchivePurpose.PARTNER) |
391 | 265 | |||
392 | 266 | |||
393 | 267 | def test_suite(): | ||
394 | 268 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
395 | 269 | 265 | ||
396 | === modified file 'lib/lp/soyuz/scripts/tests/test_gina.py' | |||
397 | --- lib/lp/soyuz/scripts/tests/test_gina.py 2010-07-14 14:11:15 +0000 | |||
398 | +++ lib/lp/soyuz/scripts/tests/test_gina.py 2010-07-21 07:48:48 +0000 | |||
399 | @@ -1,4 +1,4 @@ | |||
401 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
402 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
403 | 3 | 3 | ||
404 | 4 | import unittest | 4 | import unittest |
405 | @@ -12,4 +12,3 @@ | |||
406 | 12 | suite = unittest.TestSuite() | 12 | suite = unittest.TestSuite() |
407 | 13 | suite.addTest(DocTestSuite(lp.soyuz.scripts.gina.handlers)) | 13 | suite.addTest(DocTestSuite(lp.soyuz.scripts.gina.handlers)) |
408 | 14 | return suite | 14 | return suite |
409 | 15 | |||
410 | 16 | 15 | ||
411 | === modified file 'lib/lp/soyuz/scripts/tests/test_lpquerydistro.py' | |||
412 | --- lib/lp/soyuz/scripts/tests/test_lpquerydistro.py 2009-12-13 11:55:40 +0000 | |||
413 | +++ lib/lp/soyuz/scripts/tests/test_lpquerydistro.py 2010-07-21 07:48:48 +0000 | |||
414 | @@ -1,4 +1,4 @@ | |||
416 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
417 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
418 | 3 | 3 | ||
419 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
420 | @@ -65,7 +65,7 @@ | |||
421 | 65 | Check that: | 65 | Check that: |
422 | 66 | * return code is ONE, | 66 | * return code is ONE, |
423 | 67 | * standard output is empty | 67 | * standard output is empty |
425 | 68 | * standard error contains the additional information about the failure. | 68 | * standard error contains additional information about the failure. |
426 | 69 | """ | 69 | """ |
427 | 70 | returncode, out, err = self.runLpQueryDistro( | 70 | returncode, out, err = self.runLpQueryDistro( |
428 | 71 | extra_args=[]) | 71 | extra_args=[]) |
429 | @@ -103,7 +103,7 @@ | |||
430 | 103 | Check if: | 103 | Check if: |
431 | 104 | * return code is ONE, | 104 | * return code is ONE, |
432 | 105 | * standard output is empty | 105 | * standard output is empty |
434 | 106 | * standard error contains the additional information about the failure. | 106 | * standard error contains additional information about the failure. |
435 | 107 | """ | 107 | """ |
436 | 108 | returncode, out, err = self.runLpQueryDistro( | 108 | returncode, out, err = self.runLpQueryDistro( |
437 | 109 | extra_args=['-s', 'hoary', 'current']) | 109 | extra_args=['-s', 'hoary', 'current']) |
438 | @@ -257,7 +257,3 @@ | |||
439 | 257 | self.assertEqual(helper.nominated_arch_indep, 'i386') | 257 | self.assertEqual(helper.nominated_arch_indep, 'i386') |
440 | 258 | self.assertEqual(helper.pocket_suffixes, | 258 | self.assertEqual(helper.pocket_suffixes, |
441 | 259 | '-backports -proposed -security -updates') | 259 | '-backports -proposed -security -updates') |
442 | 260 | |||
443 | 261 | |||
444 | 262 | def test_suite(): | ||
445 | 263 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
446 | 264 | 260 | ||
447 | === modified file 'lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py' | |||
448 | --- lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py 2010-01-31 19:36:27 +0000 | |||
449 | +++ lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py 2010-07-21 07:48:48 +0000 | |||
450 | @@ -1,4 +1,4 @@ | |||
452 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
453 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
454 | 3 | 3 | ||
455 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
456 | @@ -21,6 +21,7 @@ | |||
457 | 21 | from lp.registry.interfaces.distribution import IDistributionSet | 21 | from lp.registry.interfaces.distribution import IDistributionSet |
458 | 22 | from lp.registry.interfaces.series import SeriesStatus | 22 | from lp.registry.interfaces.series import SeriesStatus |
459 | 23 | from lp.soyuz.interfaces.publishing import PackagePublishingStatus | 23 | from lp.soyuz.interfaces.publishing import PackagePublishingStatus |
460 | 24 | from lp.testing.fakemethod import FakeMethod | ||
461 | 24 | from canonical.testing import LaunchpadZopelessLayer | 25 | from canonical.testing import LaunchpadZopelessLayer |
462 | 25 | 26 | ||
463 | 26 | 27 | ||
464 | @@ -82,8 +83,10 @@ | |||
465 | 82 | Allow tests to use a set of default options and pass an | 83 | Allow tests to use a set of default options and pass an |
466 | 83 | inactive logger to ObsoleteDistroseries. | 84 | inactive logger to ObsoleteDistroseries. |
467 | 84 | """ | 85 | """ |
470 | 85 | test_args = ['-s', suite, | 86 | test_args = [ |
471 | 86 | '-d', distribution,] | 87 | '-s', suite, |
472 | 88 | '-d', distribution, | ||
473 | 89 | ] | ||
474 | 87 | 90 | ||
475 | 88 | if confirm_all: | 91 | if confirm_all: |
476 | 89 | test_args.append('-y') | 92 | test_args.append('-y') |
477 | @@ -92,9 +95,7 @@ | |||
478 | 92 | name='obsolete-distroseries', test_args=test_args) | 95 | name='obsolete-distroseries', test_args=test_args) |
479 | 93 | # Swallow all log messages. | 96 | # Swallow all log messages. |
480 | 94 | obsoleter.logger = FakeLogger() | 97 | obsoleter.logger = FakeLogger() |
484 | 95 | def message(self, prefix, *stuff, **kw): | 98 | obsoleter.logger.message = FakeMethod() |
482 | 96 | pass | ||
483 | 97 | obsoleter.logger.message = message | ||
485 | 98 | obsoleter.setupLocation() | 99 | obsoleter.setupLocation() |
486 | 99 | return obsoleter | 100 | return obsoleter |
487 | 100 | 101 | ||
488 | @@ -208,7 +209,3 @@ | |||
489 | 208 | binary = BinaryPackagePublishingHistory.get(id) | 209 | binary = BinaryPackagePublishingHistory.get(id) |
490 | 209 | self.assertTrue( | 210 | self.assertTrue( |
491 | 210 | binary.status != PackagePublishingStatus.OBSOLETE) | 211 | binary.status != PackagePublishingStatus.OBSOLETE) |
492 | 211 | |||
493 | 212 | |||
494 | 213 | def test_suite(): | ||
495 | 214 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
496 | 215 | 212 | ||
497 | === modified file 'lib/lp/soyuz/scripts/tests/test_overrides_checker.py' | |||
498 | --- lib/lp/soyuz/scripts/tests/test_overrides_checker.py 2009-06-25 04:06:00 +0000 | |||
499 | +++ lib/lp/soyuz/scripts/tests/test_overrides_checker.py 2010-07-21 07:48:48 +0000 | |||
500 | @@ -1,11 +1,11 @@ | |||
502 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
503 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
504 | 3 | 3 | ||
505 | 4 | """archive-override-check tool base class tests.""" | 4 | """archive-override-check tool base class tests.""" |
506 | 5 | 5 | ||
507 | 6 | __metaclass__ = type | 6 | __metaclass__ = type |
508 | 7 | 7 | ||
510 | 8 | from unittest import TestCase, TestLoader | 8 | from unittest import TestCase |
511 | 9 | from lp.soyuz.scripts.ftpmaster import ( | 9 | from lp.soyuz.scripts.ftpmaster import ( |
512 | 10 | PubBinaryDetails, PubSourceChecker, PubBinaryContent) | 10 | PubBinaryDetails, PubSourceChecker, PubBinaryContent) |
513 | 11 | 11 | ||
514 | @@ -29,7 +29,7 @@ | |||
515 | 29 | 1, len(self.binary_details.priorities['foo-dev'])) | 29 | 1, len(self.binary_details.priorities['foo-dev'])) |
516 | 30 | # not correct value was set yet | 30 | # not correct value was set yet |
517 | 31 | self.assertEqual( | 31 | self.assertEqual( |
519 | 32 | False, self.binary_details.correct_priorities.has_key('foo-dev')) | 32 | False, 'foo-dev' in self.binary_details.correct_priorities) |
520 | 33 | # set correct values | 33 | # set correct values |
521 | 34 | self.binary_details.setCorrectValues() | 34 | self.binary_details.setCorrectValues() |
522 | 35 | # now we have the correct value in place | 35 | # now we have the correct value in place |
523 | @@ -151,7 +151,6 @@ | |||
524 | 151 | "\t\tW: Priority mismatch: EXTRA != REQUIRED", | 151 | "\t\tW: Priority mismatch: EXTRA != REQUIRED", |
525 | 152 | checker.renderReport()) | 152 | checker.renderReport()) |
526 | 153 | 153 | ||
527 | 154 | |||
528 | 155 | def test_multi_binary_priority_success(self): | 154 | def test_multi_binary_priority_success(self): |
529 | 156 | """Probe multiple binaries with correct priorities. | 155 | """Probe multiple binaries with correct priorities. |
530 | 157 | 156 | ||
531 | @@ -169,7 +168,3 @@ | |||
532 | 169 | checker.check() | 168 | checker.check() |
533 | 170 | 169 | ||
534 | 171 | self.assertEqual(None, checker.renderReport()) | 170 | self.assertEqual(None, checker.renderReport()) |
535 | 172 | |||
536 | 173 | |||
537 | 174 | def test_suite(): | ||
538 | 175 | return TestLoader().loadTestsFromName(__name__) | ||
539 | 176 | 171 | ||
540 | === modified file 'lib/lp/soyuz/scripts/tests/test_populatearchive.py' | |||
541 | --- lib/lp/soyuz/scripts/tests/test_populatearchive.py 2010-07-15 21:30:26 +0000 | |||
542 | +++ lib/lp/soyuz/scripts/tests/test_populatearchive.py 2010-07-21 07:48:48 +0000 | |||
543 | @@ -1,4 +1,4 @@ | |||
545 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
546 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
547 | 3 | 3 | ||
548 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
549 | @@ -8,7 +8,6 @@ | |||
550 | 8 | import subprocess | 8 | import subprocess |
551 | 9 | import sys | 9 | import sys |
552 | 10 | import time | 10 | import time |
553 | 11 | import unittest | ||
554 | 12 | 11 | ||
555 | 13 | from zope.component import getUtility | 12 | from zope.component import getUtility |
556 | 14 | from zope.security.proxy import removeSecurityProxy | 13 | from zope.security.proxy import removeSecurityProxy |
557 | @@ -29,6 +28,7 @@ | |||
558 | 29 | from lp.soyuz.scripts.populate_archive import ArchivePopulator | 28 | from lp.soyuz.scripts.populate_archive import ArchivePopulator |
559 | 30 | from lp.soyuz.tests.test_publishing import SoyuzTestPublisher | 29 | from lp.soyuz.tests.test_publishing import SoyuzTestPublisher |
560 | 31 | from lp.testing import TestCaseWithFactory | 30 | from lp.testing import TestCaseWithFactory |
561 | 31 | from lp.testing.faketransaction import FakeTransaction | ||
562 | 32 | 32 | ||
563 | 33 | 33 | ||
564 | 34 | def get_spn(build): | 34 | def get_spn(build): |
565 | @@ -179,11 +179,6 @@ | |||
566 | 179 | the script | 179 | the script |
567 | 180 | :param output_substr: this must be part of the script's output | 180 | :param output_substr: this must be part of the script's output |
568 | 181 | """ | 181 | """ |
569 | 182 | class FakeZopeTransactionManager: | ||
570 | 183 | def commit(self): | ||
571 | 184 | pass | ||
572 | 185 | def begin(self): | ||
573 | 186 | pass | ||
574 | 187 | 182 | ||
575 | 188 | if copy_archive_name is None: | 183 | if copy_archive_name is None: |
576 | 189 | now = int(time.time()) | 184 | now = int(time.time()) |
577 | @@ -211,7 +206,7 @@ | |||
578 | 211 | script_args = [ | 206 | script_args = [ |
579 | 212 | '--from-distribution', distro_name, '--from-suite', suite, | 207 | '--from-distribution', distro_name, '--from-suite', suite, |
580 | 213 | '--to-distribution', distro_name, '--to-suite', suite, | 208 | '--to-distribution', distro_name, '--to-suite', suite, |
582 | 214 | '--to-archive', archive_name, '--to-user', user | 209 | '--to-archive', archive_name, '--to-user', user, |
583 | 215 | ] | 210 | ] |
584 | 216 | 211 | ||
585 | 217 | # Empty reason string indicates that the '--reason' command line | 212 | # Empty reason string indicates that the '--reason' command line |
586 | @@ -233,7 +228,7 @@ | |||
587 | 233 | test_args=script_args) | 228 | test_args=script_args) |
588 | 234 | 229 | ||
589 | 235 | script.logger = BufferLogger() | 230 | script.logger = BufferLogger() |
591 | 236 | script.txn = FakeZopeTransactionManager() | 231 | script.txn = FakeTransaction() |
592 | 237 | 232 | ||
593 | 238 | if exception_type is not None: | 233 | if exception_type is not None: |
594 | 239 | self.assertRaisesWithContent( | 234 | self.assertRaisesWithContent( |
595 | @@ -393,9 +388,10 @@ | |||
596 | 393 | # The set of packages that were superseded in the target archive. | 388 | # The set of packages that were superseded in the target archive. |
597 | 394 | obsolete=set(['alsa-utils 1.0.9a-4ubuntu1 in hoary']), | 389 | obsolete=set(['alsa-utils 1.0.9a-4ubuntu1 in hoary']), |
598 | 395 | # The set of packages that are new/fresher in the source archive. | 390 | # The set of packages that are new/fresher in the source archive. |
602 | 396 | new=set(['alsa-utils 2.0 in hoary', | 391 | new=set([ |
603 | 397 | 'new-in-second-round 1.0 in hoary']) | 392 | 'alsa-utils 2.0 in hoary', |
604 | 398 | ) | 393 | 'new-in-second-round 1.0 in hoary', |
605 | 394 | ])) | ||
606 | 399 | 395 | ||
607 | 400 | # Now populate a 3rd copy archive from the first ubuntu/hoary | 396 | # Now populate a 3rd copy archive from the first ubuntu/hoary |
608 | 401 | # snapshot. | 397 | # snapshot. |
609 | @@ -423,9 +419,10 @@ | |||
610 | 423 | # The set of packages that were superseded in the target archive. | 419 | # The set of packages that were superseded in the target archive. |
611 | 424 | obsolete=set(['alsa-utils 1.0.9a-4ubuntu1 in hoary']), | 420 | obsolete=set(['alsa-utils 1.0.9a-4ubuntu1 in hoary']), |
612 | 425 | # The set of packages that are new/fresher in the source archive. | 421 | # The set of packages that are new/fresher in the source archive. |
616 | 426 | new=set(['alsa-utils 2.0 in hoary', | 422 | new=set([ |
617 | 427 | 'new-in-second-round 1.0 in hoary']) | 423 | 'alsa-utils 2.0 in hoary', |
618 | 428 | ) | 424 | 'new-in-second-round 1.0 in hoary', |
619 | 425 | ])) | ||
620 | 429 | 426 | ||
621 | 430 | def testUnknownOriginArchive(self): | 427 | def testUnknownOriginArchive(self): |
622 | 431 | """Try copy archive population with a unknown origin archive. | 428 | """Try copy archive population with a unknown origin archive. |
623 | @@ -558,6 +555,7 @@ | |||
624 | 558 | 555 | ||
625 | 559 | def testBuildsPendingAndSuspended(self): | 556 | def testBuildsPendingAndSuspended(self): |
626 | 560 | """All builds in the new copy archive are pending and suspended.""" | 557 | """All builds in the new copy archive are pending and suspended.""" |
627 | 558 | |||
628 | 561 | def build_in_wrong_state(build): | 559 | def build_in_wrong_state(build): |
629 | 562 | """True if the given build is not (pending and suspended).""" | 560 | """True if the given build is not (pending and suspended).""" |
630 | 563 | return not ( | 561 | return not ( |
631 | @@ -584,7 +582,7 @@ | |||
632 | 584 | # - binary build: pending | 582 | # - binary build: pending |
633 | 585 | # - job: suspended | 583 | # - job: suspended |
634 | 586 | builds_in_wrong_state = filter(build_in_wrong_state, builds) | 584 | builds_in_wrong_state = filter(build_in_wrong_state, builds) |
636 | 587 | self.assertEqual ( | 585 | self.assertEqual( |
637 | 588 | [], builds_in_wrong_state, | 586 | [], builds_in_wrong_state, |
638 | 589 | "The binary builds generated for the target copy archive " | 587 | "The binary builds generated for the target copy archive " |
639 | 590 | "should all be pending and suspended. However, at least one of " | 588 | "should all be pending and suspended. However, at least one of " |
640 | @@ -698,6 +696,3 @@ | |||
641 | 698 | # Make sure the source to be copied are the ones we expect (this | 696 | # Make sure the source to be copied are the ones we expect (this |
642 | 699 | # should break in case of a sample data change/corruption). | 697 | # should break in case of a sample data change/corruption). |
643 | 700 | self.assertEqual(src_names, self.expected_src_names) | 698 | self.assertEqual(src_names, self.expected_src_names) |
644 | 701 | |||
645 | 702 | def test_suite(): | ||
646 | 703 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
647 | 704 | 699 | ||
648 | === modified file 'lib/lp/soyuz/scripts/tests/test_ppa_apache_log_parser.py' | |||
649 | --- lib/lp/soyuz/scripts/tests/test_ppa_apache_log_parser.py 2010-03-16 09:52:53 +0000 | |||
650 | +++ lib/lp/soyuz/scripts/tests/test_ppa_apache_log_parser.py 2010-07-21 07:48:48 +0000 | |||
651 | @@ -3,7 +3,6 @@ | |||
652 | 3 | 3 | ||
653 | 4 | from datetime import date | 4 | from datetime import date |
654 | 5 | import subprocess | 5 | import subprocess |
655 | 6 | import unittest | ||
656 | 7 | 6 | ||
657 | 8 | from zope.component import getUtility | 7 | from zope.component import getUtility |
658 | 9 | 8 | ||
659 | @@ -128,7 +127,3 @@ | |||
660 | 128 | [(result.binary_package_release, result.archive, result.day, | 127 | [(result.binary_package_release, result.archive, result.day, |
661 | 129 | result.country, result.count) for result in results], | 128 | result.country, result.count) for result in results], |
662 | 130 | key=lambda r: (r[0].id, r[2], r[3].name if r[3] else None))) | 129 | key=lambda r: (r[0].id, r[2], r[3].name if r[3] else None))) |
663 | 131 | |||
664 | 132 | |||
665 | 133 | def test_suite(): | ||
666 | 134 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
667 | 135 | 130 | ||
668 | === modified file 'lib/lp/soyuz/scripts/tests/test_ppakeygenerator.py' | |||
669 | --- lib/lp/soyuz/scripts/tests/test_ppakeygenerator.py 2009-06-25 04:06:00 +0000 | |||
670 | +++ lib/lp/soyuz/scripts/tests/test_ppakeygenerator.py 2010-07-21 07:48:48 +0000 | |||
671 | @@ -1,12 +1,10 @@ | |||
673 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
674 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
675 | 3 | 3 | ||
676 | 4 | """`PPAKeyGenerator` script class tests.""" | 4 | """`PPAKeyGenerator` script class tests.""" |
677 | 5 | 5 | ||
678 | 6 | __metaclass__ = type | 6 | __metaclass__ = type |
679 | 7 | 7 | ||
680 | 8 | import unittest | ||
681 | 9 | |||
682 | 10 | from zope.component import getUtility | 8 | from zope.component import getUtility |
683 | 11 | 9 | ||
684 | 12 | from lp.soyuz.interfaces.archive import IArchiveSet | 10 | from lp.soyuz.interfaces.archive import IArchiveSet |
685 | @@ -16,32 +14,13 @@ | |||
686 | 16 | from lp.services.scripts.base import LaunchpadScriptFailure | 14 | from lp.services.scripts.base import LaunchpadScriptFailure |
687 | 17 | from lp.soyuz.scripts.ppakeygenerator import PPAKeyGenerator | 15 | from lp.soyuz.scripts.ppakeygenerator import PPAKeyGenerator |
688 | 18 | from lp.testing import TestCase | 16 | from lp.testing import TestCase |
689 | 17 | from lp.testing.faketransaction import FakeTransaction | ||
690 | 19 | from canonical.testing import LaunchpadZopelessLayer | 18 | from canonical.testing import LaunchpadZopelessLayer |
691 | 20 | 19 | ||
692 | 21 | 20 | ||
693 | 22 | class TestPPAKeyGenerator(TestCase): | 21 | class TestPPAKeyGenerator(TestCase): |
694 | 23 | layer = LaunchpadZopelessLayer | 22 | layer = LaunchpadZopelessLayer |
695 | 24 | 23 | ||
696 | 25 | def _getFakeZTM(self): | ||
697 | 26 | """Return an instrumented `ZopeTransactionManager`-like object. | ||
698 | 27 | |||
699 | 28 | I does nothing apart counting the number of commits issued. | ||
700 | 29 | |||
701 | 30 | The result is stored in the 'number_of_commits'. | ||
702 | 31 | """ | ||
703 | 32 | self.number_of_commits = 0 | ||
704 | 33 | |||
705 | 34 | def commit_called(): | ||
706 | 35 | self.number_of_commits += 1 | ||
707 | 36 | |||
708 | 37 | class FakeZTM: | ||
709 | 38 | def commit(self): | ||
710 | 39 | commit_called() | ||
711 | 40 | def begin(self): | ||
712 | 41 | pass | ||
713 | 42 | |||
714 | 43 | return FakeZTM() | ||
715 | 44 | |||
716 | 45 | def _fixArchiveForKeyGeneration(self, archive): | 24 | def _fixArchiveForKeyGeneration(self, archive): |
717 | 46 | """Override the given archive distribution to 'ubuntutest'. | 25 | """Override the given archive distribution to 'ubuntutest'. |
718 | 47 | 26 | ||
719 | @@ -51,12 +30,12 @@ | |||
720 | 51 | ubuntutest = getUtility(IDistributionSet).getByName('ubuntutest') | 30 | ubuntutest = getUtility(IDistributionSet).getByName('ubuntutest') |
721 | 52 | archive.distribution = ubuntutest | 31 | archive.distribution = ubuntutest |
722 | 53 | 32 | ||
724 | 54 | def _getKeyGenerator(self, ppa_owner_name=None): | 33 | def _getKeyGenerator(self, ppa_owner_name=None, txn=None): |
725 | 55 | """Return a `PPAKeyGenerator` instance. | 34 | """Return a `PPAKeyGenerator` instance. |
726 | 56 | 35 | ||
730 | 57 | Monkey-patch the script object transaction manager (see | 36 | Monkey-patch the script object with a fake transaction manager |
731 | 58 | `_getFakeZTM`) and also to use a alternative (fake and lighter) | 37 | and also make it use an alternative (fake and lighter) procedure |
732 | 59 | procedure to generate keys for each PPA. | 38 | to generate keys for each PPA. |
733 | 60 | """ | 39 | """ |
734 | 61 | test_args = [] | 40 | test_args = [] |
735 | 62 | 41 | ||
736 | @@ -66,7 +45,9 @@ | |||
737 | 66 | key_generator = PPAKeyGenerator( | 45 | key_generator = PPAKeyGenerator( |
738 | 67 | name='ppa-generate-keys', test_args=test_args) | 46 | name='ppa-generate-keys', test_args=test_args) |
739 | 68 | 47 | ||
741 | 69 | key_generator.txn = self._getFakeZTM() | 48 | if txn is None: |
742 | 49 | txn = FakeTransaction() | ||
743 | 50 | key_generator.txn = txn | ||
744 | 70 | 51 | ||
745 | 71 | def fake_key_generation(archive): | 52 | def fake_key_generation(archive): |
746 | 72 | a_key = getUtility(IGPGKeySet).get(1) | 53 | a_key = getUtility(IGPGKeySet).get(1) |
747 | @@ -102,7 +83,7 @@ | |||
748 | 102 | self.assertRaisesWithContent( | 83 | self.assertRaisesWithContent( |
749 | 103 | LaunchpadScriptFailure, | 84 | LaunchpadScriptFailure, |
750 | 104 | ("PPA for Celso Providelo already has a signing_key (%s)" % | 85 | ("PPA for Celso Providelo already has a signing_key (%s)" % |
752 | 105 | cprov.archive.signing_key.fingerprint) , | 86 | cprov.archive.signing_key.fingerprint), |
753 | 106 | key_generator.main) | 87 | key_generator.main) |
754 | 107 | 88 | ||
755 | 108 | def testGenerateKeyForASinglePPA(self): | 89 | def testGenerateKeyForASinglePPA(self): |
756 | @@ -116,11 +97,12 @@ | |||
757 | 116 | 97 | ||
758 | 117 | self.assertTrue(cprov.archive.signing_key is None) | 98 | self.assertTrue(cprov.archive.signing_key is None) |
759 | 118 | 99 | ||
761 | 119 | key_generator = self._getKeyGenerator(ppa_owner_name='cprov') | 100 | txn = FakeTransaction() |
762 | 101 | key_generator = self._getKeyGenerator(ppa_owner_name='cprov', txn=txn) | ||
763 | 120 | key_generator.main() | 102 | key_generator.main() |
764 | 121 | 103 | ||
765 | 122 | self.assertTrue(cprov.archive.signing_key is not None) | 104 | self.assertTrue(cprov.archive.signing_key is not None) |
767 | 123 | self.assertEquals(self.number_of_commits, 1) | 105 | self.assertEquals(txn.commit_count, 1) |
768 | 124 | 106 | ||
769 | 125 | def testGenerateKeyForAllPPA(self): | 107 | def testGenerateKeyForAllPPA(self): |
770 | 126 | """Signing key generation for all PPAs. | 108 | """Signing key generation for all PPAs. |
771 | @@ -134,14 +116,11 @@ | |||
772 | 134 | self._fixArchiveForKeyGeneration(archive) | 116 | self._fixArchiveForKeyGeneration(archive) |
773 | 135 | self.assertTrue(archive.signing_key is None) | 117 | self.assertTrue(archive.signing_key is None) |
774 | 136 | 118 | ||
776 | 137 | key_generator = self._getKeyGenerator() | 119 | txn = FakeTransaction() |
777 | 120 | key_generator = self._getKeyGenerator(txn=txn) | ||
778 | 138 | key_generator.main() | 121 | key_generator.main() |
779 | 139 | 122 | ||
780 | 140 | for archive in archives: | 123 | for archive in archives: |
781 | 141 | self.assertTrue(archive.signing_key is not None) | 124 | self.assertTrue(archive.signing_key is not None) |
782 | 142 | 125 | ||
788 | 143 | self.assertEquals(self.number_of_commits, len(archives)) | 126 | self.assertEquals(txn.commit_count, len(archives)) |
784 | 144 | |||
785 | 145 | |||
786 | 146 | def test_suite(): | ||
787 | 147 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
789 | 148 | 127 | ||
790 | === modified file 'lib/lp/soyuz/scripts/tests/test_ppareport.py' | |||
791 | --- lib/lp/soyuz/scripts/tests/test_ppareport.py 2009-08-13 19:03:36 +0000 | |||
792 | +++ lib/lp/soyuz/scripts/tests/test_ppareport.py 2010-07-21 07:48:48 +0000 | |||
793 | @@ -1,4 +1,4 @@ | |||
795 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
796 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
797 | 3 | 3 | ||
798 | 4 | """Tests for `PPAReportScript.` """ | 4 | """Tests for `PPAReportScript.` """ |
799 | @@ -16,6 +16,7 @@ | |||
800 | 16 | from canonical.testing import LaunchpadZopelessLayer | 16 | from canonical.testing import LaunchpadZopelessLayer |
801 | 17 | from lp.services.scripts.base import LaunchpadScriptFailure | 17 | from lp.services.scripts.base import LaunchpadScriptFailure |
802 | 18 | from lp.soyuz.scripts.ppareport import PPAReportScript | 18 | from lp.soyuz.scripts.ppareport import PPAReportScript |
803 | 19 | from lp.testing.fakemethod import FakeMethod | ||
804 | 19 | 20 | ||
805 | 20 | 21 | ||
806 | 21 | class TestPPAReport(unittest.TestCase): | 22 | class TestPPAReport(unittest.TestCase): |
807 | @@ -68,13 +69,12 @@ | |||
808 | 68 | # Override the output handlers if no 'output' option was passed | 69 | # Override the output handlers if no 'output' option was passed |
809 | 69 | # via command-line. | 70 | # via command-line. |
810 | 70 | if output is None: | 71 | if output is None: |
811 | 72 | |||
812 | 71 | def set_test_output(): | 73 | def set_test_output(): |
813 | 72 | reporter.output = StringIO() | 74 | reporter.output = StringIO() |
814 | 73 | reporter.setOutput = set_test_output | 75 | reporter.setOutput = set_test_output |
815 | 74 | 76 | ||
819 | 75 | def close_test_output(): | 77 | reporter.closeOutput = FakeMethod() |
817 | 76 | pass | ||
818 | 77 | reporter.closeOutput = close_test_output | ||
820 | 78 | 78 | ||
821 | 79 | return reporter | 79 | return reporter |
822 | 80 | 80 | ||
823 | @@ -137,8 +137,7 @@ | |||
824 | 137 | reporter.output.getvalue().splitlines(), [ | 137 | reporter.output.getvalue().splitlines(), [ |
825 | 138 | '= PPAs over 80.00% of their quota =', | 138 | '= PPAs over 80.00% of their quota =', |
826 | 139 | '', | 139 | '', |
829 | 140 | ] | 140 | ]) |
828 | 141 | ) | ||
830 | 142 | 141 | ||
831 | 143 | # Quota threshold can be specified. | 142 | # Quota threshold can be specified. |
832 | 144 | reporter = self.getReporter(quota_threshold=.01) | 143 | reporter = self.getReporter(quota_threshold=.01) |
833 | @@ -150,8 +149,7 @@ | |||
834 | 150 | 'http://launchpad.dev/~cprov/+archive/ppa | 1024 | 9', | 149 | 'http://launchpad.dev/~cprov/+archive/ppa | 1024 | 9', |
835 | 151 | 'http://launchpad.dev/~mark/+archive/ppa | 1024 | 9', | 150 | 'http://launchpad.dev/~mark/+archive/ppa | 1024 | 9', |
836 | 152 | '', | 151 | '', |
839 | 153 | ] | 152 | ]) |
838 | 154 | ) | ||
840 | 155 | 153 | ||
841 | 156 | def testUserEmails(self): | 154 | def testUserEmails(self): |
842 | 157 | # UserEmails report lists user name, user displayname and user | 155 | # UserEmails report lists user name, user displayname and user |
843 | @@ -166,8 +164,7 @@ | |||
844 | 166 | 'cprov | Celso Providelo | celso.providelo@canonical.com', | 164 | 'cprov | Celso Providelo | celso.providelo@canonical.com', |
845 | 167 | 'mark | Mark Shuttleworth | mark@example.com', | 165 | 'mark | Mark Shuttleworth | mark@example.com', |
846 | 168 | '', | 166 | '', |
849 | 169 | ] | 167 | ]) |
848 | 170 | ) | ||
850 | 171 | 168 | ||
851 | 172 | # UserEmails report can be generated for a single PPA. | 169 | # UserEmails report can be generated for a single PPA. |
852 | 173 | reporter = self.getReporter(ppa_owner='cprov') | 170 | reporter = self.getReporter(ppa_owner='cprov') |
853 | @@ -178,8 +175,7 @@ | |||
854 | 178 | '= PPA user emails =', | 175 | '= PPA user emails =', |
855 | 179 | 'cprov | Celso Providelo | celso.providelo@canonical.com', | 176 | 'cprov | Celso Providelo | celso.providelo@canonical.com', |
856 | 180 | '', | 177 | '', |
859 | 181 | ] | 178 | ]) |
858 | 182 | ) | ||
860 | 183 | 179 | ||
861 | 184 | def testOrphanRepos(self): | 180 | def testOrphanRepos(self): |
862 | 185 | # OrphanRepos report lists all directories in the PPA root that | 181 | # OrphanRepos report lists all directories in the PPA root that |
863 | @@ -192,8 +188,7 @@ | |||
864 | 192 | reporter.output.getvalue().splitlines(), [ | 188 | reporter.output.getvalue().splitlines(), [ |
865 | 193 | '= Orphan PPA repositories =', | 189 | '= Orphan PPA repositories =', |
866 | 194 | '', | 190 | '', |
869 | 195 | ] | 191 | ]) |
868 | 196 | ) | ||
870 | 197 | # We create a 'orphan' repository. | 192 | # We create a 'orphan' repository. |
871 | 198 | orphan_repo = os.path.join( | 193 | orphan_repo = os.path.join( |
872 | 199 | config.personalpackagearchive.root, 'orphan') | 194 | config.personalpackagearchive.root, 'orphan') |
873 | @@ -208,8 +203,7 @@ | |||
874 | 208 | '= Orphan PPA repositories =', | 203 | '= Orphan PPA repositories =', |
875 | 209 | '/var/tmp/ppa.test/orphan', | 204 | '/var/tmp/ppa.test/orphan', |
876 | 210 | '', | 205 | '', |
879 | 211 | ] | 206 | ]) |
878 | 212 | ) | ||
880 | 213 | # Remove the orphan directory. | 207 | # Remove the orphan directory. |
881 | 214 | shutil.rmtree(orphan_repo) | 208 | shutil.rmtree(orphan_repo) |
882 | 215 | 209 | ||
883 | @@ -226,8 +220,7 @@ | |||
884 | 226 | '/var/tmp/ppa.test/cprov', | 220 | '/var/tmp/ppa.test/cprov', |
885 | 227 | '/var/tmp/ppa.test/mark', | 221 | '/var/tmp/ppa.test/mark', |
886 | 228 | '', | 222 | '', |
889 | 229 | ] | 223 | ]) |
888 | 230 | ) | ||
890 | 231 | # We create both active PPA repositories. | 224 | # We create both active PPA repositories. |
891 | 232 | owner_names = [ppa.owner.name for ppa in reporter.ppas] | 225 | owner_names = [ppa.owner.name for ppa in reporter.ppas] |
892 | 233 | created_repos = [] | 226 | created_repos = [] |
893 | @@ -245,8 +238,7 @@ | |||
894 | 245 | reporter.output.getvalue().splitlines(), [ | 238 | reporter.output.getvalue().splitlines(), [ |
895 | 246 | '= Missing PPA repositories =', | 239 | '= Missing PPA repositories =', |
896 | 247 | '', | 240 | '', |
899 | 248 | ] | 241 | ]) |
898 | 249 | ) | ||
900 | 250 | 242 | ||
901 | 251 | # Remove the created repositories. | 243 | # Remove the created repositories. |
902 | 252 | for repo_path in created_repos: | 244 | for repo_path in created_repos: |
903 | @@ -261,13 +253,12 @@ | |||
904 | 261 | gen_missing_repos=True, output=output_path) | 253 | gen_missing_repos=True, output=output_path) |
905 | 262 | reporter.main() | 254 | reporter.main() |
906 | 263 | self.assertEquals( | 255 | self.assertEquals( |
908 | 264 | open(output_path).read().splitlines(),[ | 256 | open(output_path).read().splitlines(), [ |
909 | 265 | '= Missing PPA repositories =', | 257 | '= Missing PPA repositories =', |
910 | 266 | '/var/tmp/ppa.test/cprov', | 258 | '/var/tmp/ppa.test/cprov', |
911 | 267 | '/var/tmp/ppa.test/mark', | 259 | '/var/tmp/ppa.test/mark', |
912 | 268 | '', | 260 | '', |
915 | 269 | ] | 261 | ]) |
914 | 270 | ) | ||
916 | 271 | # Remove the report file. | 262 | # Remove the report file. |
917 | 272 | os.remove(output_path) | 263 | os.remove(output_path) |
918 | 273 | 264 | ||
919 | @@ -288,8 +279,7 @@ | |||
920 | 288 | '/var/tmp/ppa.test/cprov', | 279 | '/var/tmp/ppa.test/cprov', |
921 | 289 | '/var/tmp/ppa.test/mark', | 280 | '/var/tmp/ppa.test/mark', |
922 | 290 | '', | 281 | '', |
925 | 291 | ] | 282 | ]) |
924 | 292 | ) | ||
926 | 293 | # Another run for generating user emails report | 283 | # Another run for generating user emails report |
927 | 294 | reporter = self.getReporter(gen_user_emails=True) | 284 | reporter = self.getReporter(gen_user_emails=True) |
928 | 295 | reporter.main() | 285 | reporter.main() |
929 | @@ -299,9 +289,4 @@ | |||
930 | 299 | 'cprov | Celso Providelo | celso.providelo@canonical.com', | 289 | 'cprov | Celso Providelo | celso.providelo@canonical.com', |
931 | 300 | 'mark | Mark Shuttleworth | mark@example.com', | 290 | 'mark | Mark Shuttleworth | mark@example.com', |
932 | 301 | '', | 291 | '', |
939 | 302 | ] | 292 | ]) |
934 | 303 | ) | ||
935 | 304 | |||
936 | 305 | |||
937 | 306 | def test_suite(): | ||
938 | 307 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
940 | 308 | 293 | ||
941 | === modified file 'lib/lp/soyuz/scripts/tests/test_processdeathrow.py' | |||
942 | --- lib/lp/soyuz/scripts/tests/test_processdeathrow.py 2009-11-15 19:52:54 +0000 | |||
943 | +++ lib/lp/soyuz/scripts/tests/test_processdeathrow.py 2010-07-21 07:48:48 +0000 | |||
944 | @@ -1,4 +1,4 @@ | |||
946 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
947 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
948 | 3 | 3 | ||
949 | 4 | """Functional tests for process-death-row.py script. | 4 | """Functional tests for process-death-row.py script. |
950 | @@ -17,7 +17,7 @@ | |||
951 | 17 | import subprocess | 17 | import subprocess |
952 | 18 | import sys | 18 | import sys |
953 | 19 | from tempfile import mkdtemp | 19 | from tempfile import mkdtemp |
955 | 20 | from unittest import TestCase, TestLoader | 20 | from unittest import TestCase |
956 | 21 | 21 | ||
957 | 22 | from zope.component import getUtility | 22 | from zope.component import getUtility |
958 | 23 | from zope.security.proxy import removeSecurityProxy | 23 | from zope.security.proxy import removeSecurityProxy |
959 | @@ -204,7 +204,3 @@ | |||
960 | 204 | self.probePublishingStatus( | 204 | self.probePublishingStatus( |
961 | 205 | self.ppa_pubrec_ids, PackagePublishingStatus.SUPERSEDED) | 205 | self.ppa_pubrec_ids, PackagePublishingStatus.SUPERSEDED) |
962 | 206 | self.probeRemoved(self.ppa_pubrec_ids) | 206 | self.probeRemoved(self.ppa_pubrec_ids) |
963 | 207 | |||
964 | 208 | |||
965 | 209 | def test_suite(): | ||
966 | 210 | return TestLoader().loadTestsFromName(__name__) | ||
967 | 211 | 207 | ||
968 | === modified file 'lib/lp/soyuz/scripts/tests/test_processpendingpackagediffs.py' | |||
969 | --- lib/lp/soyuz/scripts/tests/test_processpendingpackagediffs.py 2010-02-04 17:08:01 +0000 | |||
970 | +++ lib/lp/soyuz/scripts/tests/test_processpendingpackagediffs.py 2010-07-21 07:48:48 +0000 | |||
971 | @@ -1,4 +1,4 @@ | |||
973 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
974 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
975 | 3 | 3 | ||
976 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
977 | @@ -6,9 +6,6 @@ | |||
978 | 6 | import os | 6 | import os |
979 | 7 | import subprocess | 7 | import subprocess |
980 | 8 | import sys | 8 | import sys |
981 | 9 | import unittest | ||
982 | 10 | |||
983 | 11 | from zope.component import getUtility | ||
984 | 12 | 9 | ||
985 | 13 | from canonical.config import config | 10 | from canonical.config import config |
986 | 14 | from canonical.launchpad.scripts import QuietFakeLogger | 11 | from canonical.launchpad.scripts import QuietFakeLogger |
987 | @@ -107,6 +104,3 @@ | |||
988 | 107 | # The next run process the remaining one. | 104 | # The next run process the remaining one. |
989 | 108 | diff_processor.main() | 105 | diff_processor.main() |
990 | 109 | self.assertEqual(self.getPendingDiffs().count(), 0) | 106 | self.assertEqual(self.getPendingDiffs().count(), 0) |
991 | 110 | |||
992 | 111 | def test_suite(): | ||
993 | 112 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
994 | 113 | 107 | ||
995 | === modified file 'lib/lp/soyuz/scripts/tests/test_processupload.py' | |||
996 | --- lib/lp/soyuz/scripts/tests/test_processupload.py 2010-04-23 22:47:35 +0000 | |||
997 | +++ lib/lp/soyuz/scripts/tests/test_processupload.py 2010-07-21 07:48:48 +0000 | |||
998 | @@ -1,4 +1,4 @@ | |||
1000 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1001 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1002 | 3 | 3 | ||
1003 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
1004 | @@ -58,7 +58,7 @@ | |||
1005 | 58 | # No scriptactivity should exist before it's run. | 58 | # No scriptactivity should exist before it's run. |
1006 | 59 | activity = getUtility( | 59 | activity = getUtility( |
1007 | 60 | IScriptActivitySet).getLastActivity('process-upload') | 60 | IScriptActivitySet).getLastActivity('process-upload') |
1009 | 61 | self.assertTrue(activity is None, "'activity' should be None") | 61 | self.assertTrue(activity is None, "'activity' should be None") |
1010 | 62 | 62 | ||
1011 | 63 | returncode, out, err = self.runProcessUpload() | 63 | returncode, out, err = self.runProcessUpload() |
1012 | 64 | self.assertEqual(0, returncode) | 64 | self.assertEqual(0, returncode) |
1013 | @@ -86,20 +86,16 @@ | |||
1014 | 86 | locker.acquire() | 86 | locker.acquire() |
1015 | 87 | 87 | ||
1016 | 88 | returncode, out, err = self.runProcessUpload( | 88 | returncode, out, err = self.runProcessUpload( |
1019 | 89 | extra_args=['-C', 'insecure'] | 89 | extra_args=['-C', 'insecure']) |
1018 | 90 | ) | ||
1020 | 91 | 90 | ||
1021 | 92 | # the process-upload call terminated with ERROR and | 91 | # the process-upload call terminated with ERROR and |
1022 | 93 | # proper log message | 92 | # proper log message |
1023 | 94 | self.assertEqual(1, returncode) | 93 | self.assertEqual(1, returncode) |
1027 | 95 | self.assertEqual( | 94 | self.assertEqual([ |
1028 | 96 | ['INFO Creating lockfile: /var/lock/process-upload-insecure.lock', | 95 | ('INFO Creating lockfile: ' |
1029 | 97 | 'DEBUG Lockfile /var/lock/process-upload-insecure.lock in use' | 96 | '/var/lock/process-upload-insecure.lock'), |
1030 | 97 | 'DEBUG Lockfile /var/lock/process-upload-insecure.lock in use', | ||
1031 | 98 | ], err.splitlines()) | 98 | ], err.splitlines()) |
1032 | 99 | 99 | ||
1033 | 100 | # release the locally acquired lockfile | 100 | # release the locally acquired lockfile |
1034 | 101 | locker.release() | 101 | locker.release() |
1035 | 102 | |||
1036 | 103 | |||
1037 | 104 | def test_suite(): | ||
1038 | 105 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1039 | 106 | 102 | ||
1040 | === modified file 'lib/lp/soyuz/tests/test_archive.py' | |||
1041 | --- lib/lp/soyuz/tests/test_archive.py 2010-07-18 00:56:16 +0000 | |||
1042 | +++ lib/lp/soyuz/tests/test_archive.py 2010-07-21 07:48:48 +0000 | |||
1043 | @@ -1,4 +1,4 @@ | |||
1045 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1046 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1047 | 3 | 3 | ||
1048 | 4 | """Test Archive features.""" | 4 | """Test Archive features.""" |
1049 | @@ -8,6 +8,7 @@ | |||
1050 | 8 | 8 | ||
1051 | 9 | import pytz | 9 | import pytz |
1052 | 10 | import transaction | 10 | import transaction |
1053 | 11 | |||
1054 | 11 | from zope.component import getUtility | 12 | from zope.component import getUtility |
1055 | 12 | from zope.security.interfaces import Unauthorized | 13 | from zope.security.interfaces import Unauthorized |
1056 | 13 | from zope.security.proxy import removeSecurityProxy | 14 | from zope.security.proxy import removeSecurityProxy |
1057 | @@ -64,7 +65,7 @@ | |||
1058 | 64 | # upload dates. | 65 | # upload dates. |
1059 | 65 | self.gedit_nightly_src_hist = self.publisher.getPubSource( | 66 | self.gedit_nightly_src_hist = self.publisher.getPubSource( |
1060 | 66 | sourcename="gedit", archive=self.archives['gedit-nightly'], | 67 | sourcename="gedit", archive=self.archives['gedit-nightly'], |
1062 | 67 | date_uploaded=datetime(2010, 12 ,1, tzinfo=pytz.UTC), | 68 | date_uploaded=datetime(2010, 12, 1, tzinfo=pytz.UTC), |
1063 | 68 | status=PackagePublishingStatus.PUBLISHED) | 69 | status=PackagePublishingStatus.PUBLISHED) |
1064 | 69 | self.gedit_beta_src_hist = self.publisher.getPubSource( | 70 | self.gedit_beta_src_hist = self.publisher.getPubSource( |
1065 | 70 | sourcename="gedit", archive=self.archives['gedit-beta'], | 71 | sourcename="gedit", archive=self.archives['gedit-beta'], |
1066 | @@ -110,8 +111,7 @@ | |||
1067 | 110 | "Expected publication from %s but was instead " | 111 | "Expected publication from %s but was instead " |
1068 | 111 | "from %s." % ( | 112 | "from %s." % ( |
1069 | 112 | self.archives['gedit-beta'].displayname, | 113 | self.archives['gedit-beta'].displayname, |
1072 | 113 | results[0].archive.displayname | 114 | results[0].archive.displayname)) |
1071 | 114 | )) | ||
1073 | 115 | 115 | ||
1074 | 116 | def testReturnsOnlyPublishedPublications(self): | 116 | def testReturnsOnlyPublishedPublications(self): |
1075 | 117 | # Publications that are not published will not be returned. | 117 | # Publications that are not published will not be returned. |
1076 | @@ -136,14 +136,12 @@ | |||
1077 | 136 | archive=self.archives['ubuntu-main'], | 136 | archive=self.archives['ubuntu-main'], |
1078 | 137 | distroseries=warty, | 137 | distroseries=warty, |
1079 | 138 | date_uploaded=datetime(2010, 12, 30, tzinfo=pytz.UTC), | 138 | date_uploaded=datetime(2010, 12, 30, tzinfo=pytz.UTC), |
1082 | 139 | status=PackagePublishingStatus.PUBLISHED, | 139 | status=PackagePublishingStatus.PUBLISHED) |
1081 | 140 | ) | ||
1083 | 141 | 140 | ||
1084 | 142 | # Only the 3 results for ubuntutest are returned when requested: | 141 | # Only the 3 results for ubuntutest are returned when requested: |
1085 | 143 | results = self.archive_set.getPublicationsInArchives( | 142 | results = self.archive_set.getPublicationsInArchives( |
1086 | 144 | self.gedit_name, self.archives.values(), | 143 | self.gedit_name, self.archives.values(), |
1089 | 145 | distribution=self.distribution | 144 | distribution=self.distribution) |
1088 | 146 | ) | ||
1090 | 147 | num_results = results.count() | 145 | num_results = results.count() |
1091 | 148 | self.assertEquals(3, num_results, "Expected 3 publications but " | 146 | self.assertEquals(3, num_results, "Expected 3 publications but " |
1092 | 149 | "got %s" % num_results) | 147 | "got %s" % num_results) |
1093 | @@ -152,8 +150,7 @@ | |||
1094 | 152 | # one we created: | 150 | # one we created: |
1095 | 153 | results = self.archive_set.getPublicationsInArchives( | 151 | results = self.archive_set.getPublicationsInArchives( |
1096 | 154 | self.gedit_name, self.archives.values(), | 152 | self.gedit_name, self.archives.values(), |
1099 | 155 | distribution=ubuntu | 153 | distribution=ubuntu) |
1098 | 156 | ) | ||
1100 | 157 | num_results = results.count() | 154 | num_results = results.count() |
1101 | 158 | self.assertEquals(1, num_results, "Expected 1 publication but " | 155 | self.assertEquals(1, num_results, "Expected 1 publication but " |
1102 | 159 | "got %s" % num_results) | 156 | "got %s" % num_results) |
1103 | @@ -578,13 +575,13 @@ | |||
1104 | 578 | 575 | ||
1105 | 579 | 576 | ||
1106 | 580 | class TestArchiveCanUpload(TestCaseWithFactory): | 577 | class TestArchiveCanUpload(TestCaseWithFactory): |
1108 | 581 | """Test the various methods that verify whether uploads are allowed to | 578 | """Test the various methods that verify whether uploads are allowed to |
1109 | 582 | happen.""" | 579 | happen.""" |
1110 | 583 | 580 | ||
1111 | 584 | layer = LaunchpadZopelessLayer | 581 | layer = LaunchpadZopelessLayer |
1112 | 585 | 582 | ||
1113 | 586 | def test_checkArchivePermission_by_PPA_owner(self): | 583 | def test_checkArchivePermission_by_PPA_owner(self): |
1115 | 587 | # Uploading to a PPA should be allowed for a user that is the owner | 584 | # Uploading to a PPA should be allowed for a user that is the owner |
1116 | 588 | owner = self.factory.makePerson(name="somebody") | 585 | owner = self.factory.makePerson(name="somebody") |
1117 | 589 | archive = self.factory.makeArchive(owner=owner) | 586 | archive = self.factory.makeArchive(owner=owner) |
1118 | 590 | self.assertEquals(True, archive.checkArchivePermission(owner)) | 587 | self.assertEquals(True, archive.checkArchivePermission(owner)) |
1119 | @@ -595,12 +592,12 @@ | |||
1120 | 595 | def test_checkArchivePermission_distro_archive(self): | 592 | def test_checkArchivePermission_distro_archive(self): |
1121 | 596 | # Regular users can not upload to ubuntu | 593 | # Regular users can not upload to ubuntu |
1122 | 597 | ubuntu = getUtility(IDistributionSet).getByName('ubuntu') | 594 | ubuntu = getUtility(IDistributionSet).getByName('ubuntu') |
1124 | 598 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY, | 595 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY, |
1125 | 599 | distribution=ubuntu) | 596 | distribution=ubuntu) |
1126 | 600 | main = getUtility(IComponentSet)["main"] | 597 | main = getUtility(IComponentSet)["main"] |
1127 | 601 | # A regular user doesn't have access | 598 | # A regular user doesn't have access |
1128 | 602 | somebody = self.factory.makePerson(name="somebody") | 599 | somebody = self.factory.makePerson(name="somebody") |
1130 | 603 | self.assertEquals(False, | 600 | self.assertEquals(False, |
1131 | 604 | archive.checkArchivePermission(somebody, main)) | 601 | archive.checkArchivePermission(somebody, main)) |
1132 | 605 | # An ubuntu core developer does have access | 602 | # An ubuntu core developer does have access |
1133 | 606 | kamion = getUtility(IPersonSet).getByName('kamion') | 603 | kamion = getUtility(IPersonSet).getByName('kamion') |
1134 | @@ -609,7 +606,7 @@ | |||
1135 | 609 | def test_checkArchivePermission_ppa(self): | 606 | def test_checkArchivePermission_ppa(self): |
1136 | 610 | ubuntu = getUtility(IDistributionSet).getByName('ubuntu') | 607 | ubuntu = getUtility(IDistributionSet).getByName('ubuntu') |
1137 | 611 | owner = self.factory.makePerson(name="eigenaar") | 608 | owner = self.factory.makePerson(name="eigenaar") |
1139 | 612 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PPA, | 609 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PPA, |
1140 | 613 | distribution=ubuntu, | 610 | distribution=ubuntu, |
1141 | 614 | owner=owner) | 611 | owner=owner) |
1142 | 615 | somebody = self.factory.makePerson(name="somebody") | 612 | somebody = self.factory.makePerson(name="somebody") |
1143 | @@ -621,17 +618,17 @@ | |||
1144 | 621 | def test_checkUpload_partner_invalid_pocket(self): | 618 | def test_checkUpload_partner_invalid_pocket(self): |
1145 | 622 | # Partner archives only have release and proposed pockets | 619 | # Partner archives only have release and proposed pockets |
1146 | 623 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PARTNER) | 620 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PARTNER) |
1148 | 624 | self.assertIsInstance(archive.checkUpload(self.factory.makePerson(), | 621 | self.assertIsInstance(archive.checkUpload(self.factory.makePerson(), |
1149 | 625 | self.factory.makeDistroSeries(), | 622 | self.factory.makeDistroSeries(), |
1150 | 626 | self.factory.makeSourcePackageName(), | 623 | self.factory.makeSourcePackageName(), |
1151 | 627 | self.factory.makeComponent(), | 624 | self.factory.makeComponent(), |
1152 | 628 | PackagePublishingPocket.UPDATES), | 625 | PackagePublishingPocket.UPDATES), |
1153 | 629 | InvalidPocketForPartnerArchive) | 626 | InvalidPocketForPartnerArchive) |
1155 | 630 | 627 | ||
1156 | 631 | def test_checkUpload_ppa_invalid_pocket(self): | 628 | def test_checkUpload_ppa_invalid_pocket(self): |
1157 | 632 | # PPA archives only have release pockets | 629 | # PPA archives only have release pockets |
1158 | 633 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PPA) | 630 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PPA) |
1160 | 634 | self.assertIsInstance(archive.checkUpload(self.factory.makePerson(), | 631 | self.assertIsInstance(archive.checkUpload(self.factory.makePerson(), |
1161 | 635 | self.factory.makeDistroSeries(), | 632 | self.factory.makeDistroSeries(), |
1162 | 636 | self.factory.makeSourcePackageName(), | 633 | self.factory.makeSourcePackageName(), |
1163 | 637 | self.factory.makeComponent(), | 634 | self.factory.makeComponent(), |
1164 | @@ -756,7 +753,7 @@ | |||
1165 | 756 | self.arm = getUtility(IProcessorFamilySet).getByName('arm') | 753 | self.arm = getUtility(IProcessorFamilySet).getByName('arm') |
1166 | 757 | 754 | ||
1167 | 758 | def test_main_archive_can_use_restricted(self): | 755 | def test_main_archive_can_use_restricted(self): |
1169 | 759 | # Main archives for distributions can always use restricted | 756 | # Main archives for distributions can always use restricted |
1170 | 760 | # architectures. | 757 | # architectures. |
1171 | 761 | distro = self.factory.makeDistribution() | 758 | distro = self.factory.makeDistribution() |
1172 | 762 | self.assertContentEqual([self.arm], | 759 | self.assertContentEqual([self.arm], |
1173 | @@ -767,8 +764,10 @@ | |||
1174 | 767 | distro = self.factory.makeDistribution() | 764 | distro = self.factory.makeDistribution() |
1175 | 768 | # Restricting to all restricted architectures is fine | 765 | # Restricting to all restricted architectures is fine |
1176 | 769 | distro.main_archive.enabled_restricted_families = [self.arm] | 766 | distro.main_archive.enabled_restricted_families = [self.arm] |
1177 | 767 | |||
1178 | 770 | def restrict(): | 768 | def restrict(): |
1179 | 771 | distro.main_archive.enabled_restricted_families = [] | 769 | distro.main_archive.enabled_restricted_families = [] |
1180 | 770 | |||
1181 | 772 | self.assertRaises(CannotRestrictArchitectures, restrict) | 771 | self.assertRaises(CannotRestrictArchitectures, restrict) |
1182 | 773 | 772 | ||
1183 | 774 | def test_default(self): | 773 | def test_default(self): |
1184 | @@ -803,7 +802,8 @@ | |||
1185 | 803 | self.assertEquals(1, allowed_restricted_families.count()) | 802 | self.assertEquals(1, allowed_restricted_families.count()) |
1186 | 804 | self.assertEquals(self.arm, | 803 | self.assertEquals(self.arm, |
1187 | 805 | allowed_restricted_families[0].processorfamily) | 804 | allowed_restricted_families[0].processorfamily) |
1189 | 806 | self.assertEquals([self.arm], self.archive.enabled_restricted_families) | 805 | self.assertEquals( |
1190 | 806 | [self.arm], self.archive.enabled_restricted_families) | ||
1191 | 807 | self.archive.enabled_restricted_families = [] | 807 | self.archive.enabled_restricted_families = [] |
1192 | 808 | self.assertEquals(0, | 808 | self.assertEquals(0, |
1193 | 809 | self.archive_arch_set.getByArchive( | 809 | self.archive_arch_set.getByArchive( |
1194 | @@ -836,6 +836,7 @@ | |||
1195 | 836 | token = self.private_ppa.getAuthToken(self.joe) | 836 | token = self.private_ppa.getAuthToken(self.joe) |
1196 | 837 | self.assertEqual(token.archive_url, url) | 837 | self.assertEqual(token.archive_url, url) |
1197 | 838 | 838 | ||
1198 | 839 | |||
1199 | 839 | class TestArchivePrivacySwitching(TestCaseWithFactory): | 840 | class TestArchivePrivacySwitching(TestCaseWithFactory): |
1200 | 840 | 841 | ||
1201 | 841 | layer = LaunchpadZopelessLayer | 842 | layer = LaunchpadZopelessLayer |
1202 | @@ -1235,7 +1236,3 @@ | |||
1203 | 1235 | component=getUtility(IComponentSet)['universe']) | 1236 | component=getUtility(IComponentSet)['universe']) |
1204 | 1236 | self.assertDep('i386', 'foo-main', [main_bins[0]]) | 1237 | self.assertDep('i386', 'foo-main', [main_bins[0]]) |
1205 | 1237 | self.assertDep('i386', 'foo-universe', [universe_bins[0]]) | 1238 | self.assertDep('i386', 'foo-universe', [universe_bins[0]]) |
1206 | 1238 | |||
1207 | 1239 | |||
1208 | 1240 | def test_suite(): | ||
1209 | 1241 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1210 | 1242 | 1239 | ||
1211 | === modified file 'lib/lp/soyuz/tests/test_archive_agent.py' | |||
1212 | --- lib/lp/soyuz/tests/test_archive_agent.py 2010-07-13 10:57:31 +0000 | |||
1213 | +++ lib/lp/soyuz/tests/test_archive_agent.py 2010-07-21 07:48:48 +0000 | |||
1214 | @@ -60,4 +60,3 @@ | |||
1215 | 60 | url = self.ppa.archive_url.split('http://')[1] | 60 | url = self.ppa.archive_url.split('http://')[1] |
1216 | 61 | new_url = "http://joe:%s@%s" % (authtoken, url) | 61 | new_url = "http://joe:%s@%s" % (authtoken, url) |
1217 | 62 | self.assertEqual(sources, new_url) | 62 | self.assertEqual(sources, new_url) |
1218 | 63 | |||
1219 | 64 | 63 | ||
1220 | === modified file 'lib/lp/soyuz/tests/test_archive_privacy.py' | |||
1221 | --- lib/lp/soyuz/tests/test_archive_privacy.py 2010-06-21 10:02:54 +0000 | |||
1222 | +++ lib/lp/soyuz/tests/test_archive_privacy.py 2010-07-21 07:48:48 +0000 | |||
1223 | @@ -37,4 +37,3 @@ | |||
1224 | 37 | login_person(self.joe) | 37 | login_person(self.joe) |
1225 | 38 | p3a = getUtility(IArchiveSet).get(self.private_ppa.id) | 38 | p3a = getUtility(IArchiveSet).get(self.private_ppa.id) |
1226 | 39 | self.assertEqual(self._getDescription(p3a), "Foo") | 39 | self.assertEqual(self._getDescription(p3a), "Foo") |
1227 | 40 | |||
1228 | 41 | 40 | ||
1229 | === modified file 'lib/lp/soyuz/tests/test_archive_subscriptions.py' | |||
1230 | --- lib/lp/soyuz/tests/test_archive_subscriptions.py 2010-06-28 14:39:35 +0000 | |||
1231 | +++ lib/lp/soyuz/tests/test_archive_subscriptions.py 2010-07-21 07:48:48 +0000 | |||
1232 | @@ -1,10 +1,8 @@ | |||
1234 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1235 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1236 | 3 | 3 | ||
1237 | 4 | """Test Archive features.""" | 4 | """Test Archive features.""" |
1238 | 5 | 5 | ||
1239 | 6 | import unittest | ||
1240 | 7 | |||
1241 | 8 | from zope.security.interfaces import Unauthorized | 6 | from zope.security.interfaces import Unauthorized |
1242 | 9 | 7 | ||
1243 | 10 | from canonical.testing import DatabaseFunctionalLayer | 8 | from canonical.testing import DatabaseFunctionalLayer |
1244 | @@ -36,7 +34,6 @@ | |||
1245 | 36 | # a private team's PPA after they have been given a subscription. | 34 | # a private team's PPA after they have been given a subscription. |
1246 | 37 | # This is essentially allowing access for the subscriber to see | 35 | # This is essentially allowing access for the subscriber to see |
1247 | 38 | # the private team. | 36 | # the private team. |
1248 | 39 | |||
1249 | 40 | def get_name(): | 37 | def get_name(): |
1250 | 41 | return self.archive.owner.name | 38 | return self.archive.owner.name |
1251 | 42 | 39 | ||
1252 | @@ -51,7 +48,3 @@ | |||
1253 | 51 | # When a subscription exists, it's fine. | 48 | # When a subscription exists, it's fine. |
1254 | 52 | login_person(self.subscriber) | 49 | login_person(self.subscriber) |
1255 | 53 | self.assertEqual(self.archive.owner.name, "subscribertest") | 50 | self.assertEqual(self.archive.owner.name, "subscribertest") |
1256 | 54 | |||
1257 | 55 | |||
1258 | 56 | def test_suite(): | ||
1259 | 57 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1260 | 58 | 51 | ||
1261 | === modified file 'lib/lp/soyuz/tests/test_archivearch.py' | |||
1262 | --- lib/lp/soyuz/tests/test_archivearch.py 2010-07-05 11:00:54 +0000 | |||
1263 | +++ lib/lp/soyuz/tests/test_archivearch.py 2010-07-21 07:48:48 +0000 | |||
1264 | @@ -3,8 +3,6 @@ | |||
1265 | 3 | 3 | ||
1266 | 4 | """Test ArchiveArch features.""" | 4 | """Test ArchiveArch features.""" |
1267 | 5 | 5 | ||
1268 | 6 | import unittest | ||
1269 | 7 | |||
1270 | 8 | from zope.component import getUtility | 6 | from zope.component import getUtility |
1271 | 9 | 7 | ||
1272 | 10 | from canonical.testing import LaunchpadZopelessLayer | 8 | from canonical.testing import LaunchpadZopelessLayer |
1273 | @@ -16,6 +14,7 @@ | |||
1274 | 16 | from lp.soyuz.interfaces.archivearch import IArchiveArchSet | 14 | from lp.soyuz.interfaces.archivearch import IArchiveArchSet |
1275 | 17 | from lp.soyuz.interfaces.processor import IProcessorFamilySet | 15 | from lp.soyuz.interfaces.processor import IProcessorFamilySet |
1276 | 18 | 16 | ||
1277 | 17 | |||
1278 | 19 | class TestArchiveArch(TestCaseWithFactory): | 18 | class TestArchiveArch(TestCaseWithFactory): |
1279 | 20 | 19 | ||
1280 | 21 | layer = LaunchpadZopelessLayer | 20 | layer = LaunchpadZopelessLayer |
1281 | @@ -53,7 +52,7 @@ | |||
1282 | 53 | results = dict( | 52 | results = dict( |
1283 | 54 | (row[0].name, row[1] is not None) for row in result_set) | 53 | (row[0].name, row[1] is not None) for row in result_set) |
1284 | 55 | self.assertEquals( | 54 | self.assertEquals( |
1286 | 56 | {'arm' : False, 'cell-proc' : True, 'omap' : False}, | 55 | {'arm': False, 'cell-proc': True, 'omap': False}, |
1287 | 57 | results) | 56 | results) |
1288 | 58 | 57 | ||
1289 | 59 | def test_getRestrictedFamilies_archive_only(self): | 58 | def test_getRestrictedFamilies_archive_only(self): |
1290 | @@ -66,7 +65,7 @@ | |||
1291 | 66 | results = dict( | 65 | results = dict( |
1292 | 67 | (row[0].name, row[1] is not None) for row in result_set) | 66 | (row[0].name, row[1] is not None) for row in result_set) |
1293 | 68 | self.assertEquals( | 67 | self.assertEquals( |
1295 | 69 | {'arm' : False, 'cell-proc' : True, 'omap' : False}, | 68 | {'arm': False, 'cell-proc': True, 'omap': False}, |
1296 | 70 | results) | 69 | results) |
1297 | 71 | 70 | ||
1298 | 72 | def test_getByArchive_no_other_archives(self): | 71 | def test_getByArchive_no_other_archives(self): |
1299 | @@ -78,7 +77,3 @@ | |||
1300 | 78 | self.assertEquals(1, len(result_set)) | 77 | self.assertEquals(1, len(result_set)) |
1301 | 79 | self.assertEquals(self.ppa, result_set[0].archive) | 78 | self.assertEquals(self.ppa, result_set[0].archive) |
1302 | 80 | self.assertEquals(self.cell_proc, result_set[0].processorfamily) | 79 | self.assertEquals(self.cell_proc, result_set[0].processorfamily) |
1303 | 81 | |||
1304 | 82 | |||
1305 | 83 | def test_suite(): | ||
1306 | 84 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1307 | 85 | 80 | ||
1308 | === modified file 'lib/lp/soyuz/tests/test_binarypackagebuild.py' | |||
1309 | --- lib/lp/soyuz/tests/test_binarypackagebuild.py 2010-07-18 00:56:16 +0000 | |||
1310 | +++ lib/lp/soyuz/tests/test_binarypackagebuild.py 2010-07-21 07:48:48 +0000 | |||
1311 | @@ -1,11 +1,10 @@ | |||
1313 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1314 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1315 | 3 | 3 | ||
1316 | 4 | """Test Build features.""" | 4 | """Test Build features.""" |
1317 | 5 | 5 | ||
1318 | 6 | from datetime import datetime, timedelta | 6 | from datetime import datetime, timedelta |
1319 | 7 | import pytz | 7 | import pytz |
1320 | 8 | import unittest | ||
1321 | 9 | 8 | ||
1322 | 10 | from storm.store import Store | 9 | from storm.store import Store |
1323 | 11 | from zope.component import getUtility | 10 | from zope.component import getUtility |
1324 | @@ -91,7 +90,6 @@ | |||
1325 | 91 | previous_build.date_started = None | 90 | previous_build.date_started = None |
1326 | 92 | self.assertEqual(60, self.build.estimateDuration().seconds) | 91 | self.assertEqual(60, self.build.estimateDuration().seconds) |
1327 | 93 | 92 | ||
1328 | 94 | |||
1329 | 95 | def addFakeBuildLog(self): | 93 | def addFakeBuildLog(self): |
1330 | 96 | lfa = self.factory.makeLibraryFileAlias('mybuildlog.txt') | 94 | lfa = self.factory.makeLibraryFileAlias('mybuildlog.txt') |
1331 | 97 | removeSecurityProxy(self.build).log = lfa | 95 | removeSecurityProxy(self.build).log = lfa |
1332 | @@ -161,8 +159,8 @@ | |||
1333 | 161 | def _setupSimpleDepwaitContext(self): | 159 | def _setupSimpleDepwaitContext(self): |
1334 | 162 | """Use `SoyuzTestPublisher` to setup a simple depwait context. | 160 | """Use `SoyuzTestPublisher` to setup a simple depwait context. |
1335 | 163 | 161 | ||
1338 | 164 | Return an `IBinaryPackageBuild` in MANUALDEWAIT state and depending on a | 162 | Return an `IBinaryPackageBuild` in MANUALDEWAIT state and depending |
1339 | 165 | binary that exists and is reachable. | 163 | on a binary that exists and is reachable. |
1340 | 166 | """ | 164 | """ |
1341 | 167 | self.publisher = SoyuzTestPublisher() | 165 | self.publisher = SoyuzTestPublisher() |
1342 | 168 | self.publisher.prepareBreezyAutotest() | 166 | self.publisher.prepareBreezyAutotest() |
1343 | @@ -221,7 +219,6 @@ | |||
1344 | 221 | BinaryPackageBuild.id == depwait_build_id).count(), | 219 | BinaryPackageBuild.id == depwait_build_id).count(), |
1345 | 222 | 1) | 220 | 1) |
1346 | 223 | 221 | ||
1347 | 224 | |||
1348 | 225 | def testUpdateDependenciesWorks(self): | 222 | def testUpdateDependenciesWorks(self): |
1349 | 226 | # Calling `IBinaryPackageBuild.updateDependencies` makes the build | 223 | # Calling `IBinaryPackageBuild.updateDependencies` makes the build |
1350 | 227 | # record ready for dispatch. | 224 | # record ready for dispatch. |
1351 | @@ -464,7 +461,3 @@ | |||
1352 | 464 | class TestHandleStatusForBinaryPackageBuild( | 461 | class TestHandleStatusForBinaryPackageBuild( |
1353 | 465 | MakeBinaryPackageBuildMixin, TestHandleStatusMixin, TestCaseWithFactory): | 462 | MakeBinaryPackageBuildMixin, TestHandleStatusMixin, TestCaseWithFactory): |
1354 | 466 | """IBuildBase.handleStatus works with binary builds.""" | 463 | """IBuildBase.handleStatus works with binary builds.""" |
1355 | 467 | |||
1356 | 468 | |||
1357 | 469 | def test_suite(): | ||
1358 | 470 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1359 | 471 | 464 | ||
1360 | === modified file 'lib/lp/soyuz/tests/test_distroseriesbinarypackage.py' | |||
1361 | --- lib/lp/soyuz/tests/test_distroseriesbinarypackage.py 2010-05-28 17:28:57 +0000 | |||
1362 | +++ lib/lp/soyuz/tests/test_distroseriesbinarypackage.py 2010-07-21 07:48:48 +0000 | |||
1363 | @@ -9,7 +9,6 @@ | |||
1364 | 9 | 'test_suite', | 9 | 'test_suite', |
1365 | 10 | ] | 10 | ] |
1366 | 11 | 11 | ||
1367 | 12 | import unittest | ||
1368 | 13 | import transaction | 12 | import transaction |
1369 | 14 | 13 | ||
1370 | 15 | from lp.soyuz.model.distroseriesbinarypackage import ( | 14 | from lp.soyuz.model.distroseriesbinarypackage import ( |
1371 | @@ -63,7 +62,3 @@ | |||
1372 | 63 | 62 | ||
1373 | 64 | self.failUnlessEqual( | 63 | self.failUnlessEqual( |
1374 | 65 | 'Foo is the best', self.distroseries_binary_package.summary) | 64 | 'Foo is the best', self.distroseries_binary_package.summary) |
1375 | 66 | |||
1376 | 67 | |||
1377 | 68 | def test_suite(): | ||
1378 | 69 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1379 | 70 | 65 | ||
1380 | === modified file 'lib/lp/soyuz/tests/test_hasbuildrecords.py' | |||
1381 | --- lib/lp/soyuz/tests/test_hasbuildrecords.py 2010-06-17 09:53:24 +0000 | |||
1382 | +++ lib/lp/soyuz/tests/test_hasbuildrecords.py 2010-07-21 07:48:48 +0000 | |||
1383 | @@ -1,10 +1,8 @@ | |||
1385 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1386 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1387 | 3 | 3 | ||
1388 | 4 | """Test implementations of the IHasBuildRecords interface.""" | 4 | """Test implementations of the IHasBuildRecords interface.""" |
1389 | 5 | 5 | ||
1390 | 6 | import unittest | ||
1391 | 7 | |||
1392 | 8 | from zope.component import getUtility | 6 | from zope.component import getUtility |
1393 | 9 | from zope.security.proxy import removeSecurityProxy | 7 | from zope.security.proxy import removeSecurityProxy |
1394 | 10 | 8 | ||
1395 | @@ -67,6 +65,7 @@ | |||
1396 | 67 | 65 | ||
1397 | 68 | class TestDistroSeriesHasBuildRecords(TestHasBuildRecordsInterface): | 66 | class TestDistroSeriesHasBuildRecords(TestHasBuildRecordsInterface): |
1398 | 69 | """Test the DistroSeries implementation of IHasBuildRecords.""" | 67 | """Test the DistroSeries implementation of IHasBuildRecords.""" |
1399 | 68 | |||
1400 | 70 | def setUp(self): | 69 | def setUp(self): |
1401 | 71 | super(TestDistroSeriesHasBuildRecords, self).setUp() | 70 | super(TestDistroSeriesHasBuildRecords, self).setUp() |
1402 | 72 | 71 | ||
1403 | @@ -75,6 +74,7 @@ | |||
1404 | 75 | 74 | ||
1405 | 76 | class TestDistroArchSeriesHasBuildRecords(TestHasBuildRecordsInterface): | 75 | class TestDistroArchSeriesHasBuildRecords(TestHasBuildRecordsInterface): |
1406 | 77 | """Test the DistroArchSeries implementation of IHasBuildRecords.""" | 76 | """Test the DistroArchSeries implementation of IHasBuildRecords.""" |
1407 | 77 | |||
1408 | 78 | def setUp(self): | 78 | def setUp(self): |
1409 | 79 | super(TestDistroArchSeriesHasBuildRecords, self).setUp() | 79 | super(TestDistroArchSeriesHasBuildRecords, self).setUp() |
1410 | 80 | 80 | ||
1411 | @@ -83,6 +83,7 @@ | |||
1412 | 83 | 83 | ||
1413 | 84 | class TestArchiveHasBuildRecords(TestHasBuildRecordsInterface): | 84 | class TestArchiveHasBuildRecords(TestHasBuildRecordsInterface): |
1414 | 85 | """Test the Archive implementation of IHasBuildRecords.""" | 85 | """Test the Archive implementation of IHasBuildRecords.""" |
1415 | 86 | |||
1416 | 86 | def setUp(self): | 87 | def setUp(self): |
1417 | 87 | super(TestArchiveHasBuildRecords, self).setUp() | 88 | super(TestArchiveHasBuildRecords, self).setUp() |
1418 | 88 | 89 | ||
1419 | @@ -117,6 +118,7 @@ | |||
1420 | 117 | 118 | ||
1421 | 118 | class TestBuilderHasBuildRecords(TestHasBuildRecordsInterface): | 119 | class TestBuilderHasBuildRecords(TestHasBuildRecordsInterface): |
1422 | 119 | """Test the Builder implementation of IHasBuildRecords.""" | 120 | """Test the Builder implementation of IHasBuildRecords.""" |
1423 | 121 | |||
1424 | 120 | def setUp(self): | 122 | def setUp(self): |
1425 | 121 | super(TestBuilderHasBuildRecords, self).setUp() | 123 | super(TestBuilderHasBuildRecords, self).setUp() |
1426 | 122 | 124 | ||
1427 | @@ -171,8 +173,10 @@ | |||
1428 | 171 | IncompatibleArguments, self.context.getBuildRecords, | 173 | IncompatibleArguments, self.context.getBuildRecords, |
1429 | 172 | binary_only=False, name="anything") | 174 | binary_only=False, name="anything") |
1430 | 173 | 175 | ||
1431 | 176 | |||
1432 | 174 | class TestSourcePackageHasBuildRecords(TestHasBuildRecordsInterface): | 177 | class TestSourcePackageHasBuildRecords(TestHasBuildRecordsInterface): |
1433 | 175 | """Test the SourcePackage implementation of IHasBuildRecords.""" | 178 | """Test the SourcePackage implementation of IHasBuildRecords.""" |
1434 | 179 | |||
1435 | 176 | def setUp(self): | 180 | def setUp(self): |
1436 | 177 | super(TestSourcePackageHasBuildRecords, self).setUp() | 181 | super(TestSourcePackageHasBuildRecords, self).setUp() |
1437 | 178 | 182 | ||
1438 | @@ -187,7 +191,3 @@ | |||
1439 | 187 | for build in self.builds[1:3]: | 191 | for build in self.builds[1:3]: |
1440 | 188 | spr = build.source_package_release | 192 | spr = build.source_package_release |
1441 | 189 | removeSecurityProxy(spr).sourcepackagename = gedit_name | 193 | removeSecurityProxy(spr).sourcepackagename = gedit_name |
1442 | 190 | |||
1443 | 191 | |||
1444 | 192 | def test_suite(): | ||
1445 | 193 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1446 | 194 | 194 | ||
1447 | === modified file 'lib/lp/soyuz/tests/test_packagediff.py' | |||
1448 | --- lib/lp/soyuz/tests/test_packagediff.py 2010-02-04 17:08:01 +0000 | |||
1449 | +++ lib/lp/soyuz/tests/test_packagediff.py 2010-07-21 07:48:48 +0000 | |||
1450 | @@ -6,7 +6,6 @@ | |||
1451 | 6 | __metaclass__ = type | 6 | __metaclass__ = type |
1452 | 7 | 7 | ||
1453 | 8 | from datetime import datetime | 8 | from datetime import datetime |
1454 | 9 | import unittest | ||
1455 | 10 | 9 | ||
1456 | 11 | from zope.component import getUtility | 10 | from zope.component import getUtility |
1457 | 12 | from zope.security.proxy import removeSecurityProxy | 11 | from zope.security.proxy import removeSecurityProxy |
1458 | @@ -86,7 +85,3 @@ | |||
1459 | 86 | diff.performDiff() | 85 | diff.performDiff() |
1460 | 87 | # The diff succeeds as expected. | 86 | # The diff succeeds as expected. |
1461 | 88 | self.assertEqual(PackageDiffStatus.COMPLETED, diff.status) | 87 | self.assertEqual(PackageDiffStatus.COMPLETED, diff.status) |
1462 | 89 | |||
1463 | 90 | |||
1464 | 91 | def test_suite(): | ||
1465 | 92 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1466 | 93 | 88 | ||
1467 | === modified file 'lib/lp/soyuz/tests/test_packageupload.py' | |||
1468 | --- lib/lp/soyuz/tests/test_packageupload.py 2010-05-10 16:21:10 +0000 | |||
1469 | +++ lib/lp/soyuz/tests/test_packageupload.py 2010-07-21 07:48:48 +0000 | |||
1470 | @@ -1,11 +1,10 @@ | |||
1472 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1473 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1474 | 3 | 3 | ||
1475 | 4 | """Test Build features.""" | 4 | """Test Build features.""" |
1476 | 5 | 5 | ||
1477 | 6 | import os | 6 | import os |
1478 | 7 | import shutil | 7 | import shutil |
1479 | 8 | import unittest | ||
1480 | 9 | 8 | ||
1481 | 10 | from zope.component import getUtility | 9 | from zope.component import getUtility |
1482 | 11 | 10 | ||
1483 | @@ -333,7 +332,3 @@ | |||
1484 | 333 | # the partner archive. | 332 | # the partner archive. |
1485 | 334 | pub = package_upload.realiseUpload()[0] | 333 | pub = package_upload.realiseUpload()[0] |
1486 | 335 | self.assertEqual("partner", pub.archive.name) | 334 | self.assertEqual("partner", pub.archive.name) |
1487 | 336 | |||
1488 | 337 | |||
1489 | 338 | def test_suite(): | ||
1490 | 339 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1491 | 340 | 335 | ||
1492 | === modified file 'lib/lp/soyuz/tests/test_publish_archive_indexes.py' | |||
1493 | --- lib/lp/soyuz/tests/test_publish_archive_indexes.py 2009-10-08 08:24:03 +0000 | |||
1494 | +++ lib/lp/soyuz/tests/test_publish_archive_indexes.py 2010-07-21 07:48:48 +0000 | |||
1495 | @@ -1,4 +1,4 @@ | |||
1497 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1498 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1499 | 3 | 3 | ||
1500 | 4 | """Test native archive index generation for Soyuz.""" | 4 | """Test native archive index generation for Soyuz.""" |
1501 | @@ -10,6 +10,7 @@ | |||
1502 | 10 | 10 | ||
1503 | 11 | from lp.soyuz.tests.test_publishing import TestNativePublishingBase | 11 | from lp.soyuz.tests.test_publishing import TestNativePublishingBase |
1504 | 12 | 12 | ||
1505 | 13 | |||
1506 | 13 | class TestNativeArchiveIndexes(TestNativePublishingBase): | 14 | class TestNativeArchiveIndexes(TestNativePublishingBase): |
1507 | 14 | 15 | ||
1508 | 15 | def setUp(self): | 16 | def setUp(self): |
1509 | @@ -57,11 +58,11 @@ | |||
1510 | 57 | See also testSourceStanza, it must present something similar for | 58 | See also testSourceStanza, it must present something similar for |
1511 | 58 | binary packages. | 59 | binary packages. |
1512 | 59 | """ | 60 | """ |
1514 | 60 | pub_binary = self.getPubBinaries( | 61 | pub_binaries = self.getPubBinaries( |
1515 | 61 | depends='biscuit', recommends='foo-dev', suggests='pyfoo', | 62 | depends='biscuit', recommends='foo-dev', suggests='pyfoo', |
1516 | 62 | conflicts='old-foo', replaces='old-foo', provides='foo-master', | 63 | conflicts='old-foo', replaces='old-foo', provides='foo-master', |
1519 | 63 | pre_depends='master-foo', enhances='foo-super', breaks='old-foo' | 64 | pre_depends='master-foo', enhances='foo-super', breaks='old-foo') |
1520 | 64 | )[0] | 65 | pub_binary = pub_binaries[0] |
1521 | 65 | self.assertEqual( | 66 | self.assertEqual( |
1522 | 66 | [u'Package: foo-bin', | 67 | [u'Package: foo-bin', |
1523 | 67 | u'Source: foo', | 68 | u'Source: foo', |
1524 | @@ -135,7 +136,7 @@ | |||
1525 | 135 | u' .', | 136 | u' .', |
1526 | 136 | u' .', | 137 | u' .', |
1527 | 137 | u' .', | 138 | u' .', |
1529 | 138 | u' %s' % ('x' * 100) | 139 | u' %s' % ('x' * 100), |
1530 | 139 | ], | 140 | ], |
1531 | 140 | pub_binary.getIndexStanza().splitlines()) | 141 | pub_binary.getIndexStanza().splitlines()) |
1532 | 141 | 142 | ||
1533 | @@ -175,6 +176,7 @@ | |||
1534 | 175 | """Tests for ensuring the native archive indexes that we publish | 176 | """Tests for ensuring the native archive indexes that we publish |
1535 | 176 | can be parsed correctly by apt_get.ParseTagFiles. | 177 | can be parsed correctly by apt_get.ParseTagFiles. |
1536 | 177 | """ | 178 | """ |
1537 | 179 | |||
1538 | 178 | def setUp(self): | 180 | def setUp(self): |
1539 | 179 | """Setup global attributes.""" | 181 | """Setup global attributes.""" |
1540 | 180 | TestNativePublishingBase.setUp(self) | 182 | TestNativePublishingBase.setUp(self) |
1541 | @@ -299,6 +301,7 @@ | |||
1542 | 299 | 301 | ||
1543 | 300 | 302 | ||
1544 | 301 | class TestIndexStanzaFieldsHelper(unittest.TestCase): | 303 | class TestIndexStanzaFieldsHelper(unittest.TestCase): |
1545 | 304 | |||
1546 | 302 | def testIndexStanzaFields(self): | 305 | def testIndexStanzaFields(self): |
1547 | 303 | """Check how this auxiliary class works... | 306 | """Check how this auxiliary class works... |
1548 | 304 | 307 | ||
1549 | @@ -307,6 +310,7 @@ | |||
1550 | 307 | 310 | ||
1551 | 308 | Provides an method to format the option in a ready-to-use string. | 311 | Provides an method to format the option in a ready-to-use string. |
1552 | 309 | """ | 312 | """ |
1553 | 313 | # Avoid circular imports. | ||
1554 | 310 | from lp.soyuz.model.publishing import IndexStanzaFields | 314 | from lp.soyuz.model.publishing import IndexStanzaFields |
1555 | 311 | 315 | ||
1556 | 312 | fields = IndexStanzaFields() | 316 | fields = IndexStanzaFields() |
1557 | @@ -338,7 +342,3 @@ | |||
1558 | 338 | 342 | ||
1559 | 339 | self.assertEqual( | 343 | self.assertEqual( |
1560 | 340 | ['one: um', 'Files:<no_sep>'], fields.makeOutput().splitlines()) | 344 | ['one: um', 'Files:<no_sep>'], fields.makeOutput().splitlines()) |
1561 | 341 | |||
1562 | 342 | |||
1563 | 343 | def test_suite(): | ||
1564 | 344 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1565 | 345 | 345 | ||
1566 | === modified file 'lib/lp/soyuz/tests/test_publishing.py' | |||
1567 | --- lib/lp/soyuz/tests/test_publishing.py 2010-07-20 17:32:03 +0000 | |||
1568 | +++ lib/lp/soyuz/tests/test_publishing.py 2010-07-21 07:48:48 +0000 | |||
1569 | @@ -1,4 +1,4 @@ | |||
1571 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1572 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1573 | 3 | 3 | ||
1574 | 4 | """Test native publication workflow for Soyuz. """ | 4 | """Test native publication workflow for Soyuz. """ |
1575 | @@ -44,6 +44,7 @@ | |||
1576 | 44 | from canonical.launchpad.scripts import FakeLogger | 44 | from canonical.launchpad.scripts import FakeLogger |
1577 | 45 | from lp.testing import TestCaseWithFactory | 45 | from lp.testing import TestCaseWithFactory |
1578 | 46 | from lp.testing.factory import LaunchpadObjectFactory | 46 | from lp.testing.factory import LaunchpadObjectFactory |
1579 | 47 | from lp.testing.fakemethod import FakeMethod | ||
1580 | 47 | 48 | ||
1581 | 48 | 49 | ||
1582 | 49 | class SoyuzTestPublisher: | 50 | class SoyuzTestPublisher: |
1583 | @@ -135,7 +136,7 @@ | |||
1584 | 135 | changes_file_name="foo_666_source.changes", | 136 | changes_file_name="foo_666_source.changes", |
1585 | 136 | changes_file_content="fake changes file content", | 137 | changes_file_content="fake changes file content", |
1586 | 137 | upload_status=PackageUploadStatus.DONE): | 138 | upload_status=PackageUploadStatus.DONE): |
1588 | 138 | signing_key = self.person.gpg_keys[0] | 139 | signing_key = self.person.gpg_keys[0] |
1589 | 139 | package_upload = distroseries.createQueueEntry( | 140 | package_upload = distroseries.createQueueEntry( |
1590 | 140 | pocket, changes_file_name, changes_file_content, archive, | 141 | pocket, changes_file_name, changes_file_content, archive, |
1591 | 141 | signing_key) | 142 | signing_key) |
1592 | @@ -472,9 +473,8 @@ | |||
1593 | 472 | self.pool_dir = self.config.poolroot | 473 | self.pool_dir = self.config.poolroot |
1594 | 473 | self.temp_dir = self.config.temproot | 474 | self.temp_dir = self.config.temproot |
1595 | 474 | self.logger = FakeLogger() | 475 | self.logger = FakeLogger() |
1599 | 475 | def message(self, prefix, *stuff, **kw): | 476 | |
1600 | 476 | pass | 477 | self.logger.message = FakeMethod() |
1598 | 477 | self.logger.message = message | ||
1601 | 478 | self.disk_pool = DiskPool(self.pool_dir, self.temp_dir, self.logger) | 478 | self.disk_pool = DiskPool(self.pool_dir, self.temp_dir, self.logger) |
1602 | 479 | 479 | ||
1603 | 480 | def tearDown(self): | 480 | def tearDown(self): |
1604 | @@ -600,7 +600,7 @@ | |||
1605 | 600 | pub_source.publish(self.disk_pool, self.logger) | 600 | pub_source.publish(self.disk_pool, self.logger) |
1606 | 601 | self.layer.commit() | 601 | self.layer.commit() |
1607 | 602 | self.assertEqual( | 602 | self.assertEqual( |
1609 | 603 | pub_source.status,PackagePublishingStatus.PENDING) | 603 | pub_source.status, PackagePublishingStatus.PENDING) |
1610 | 604 | self.assertEqual(open(foo_dsc_path).read().strip(), 'Hello world') | 604 | self.assertEqual(open(foo_dsc_path).read().strip(), 'Hello world') |
1611 | 605 | 605 | ||
1612 | 606 | def testPublishingDifferentContents(self): | 606 | def testPublishingDifferentContents(self): |
1613 | @@ -779,7 +779,7 @@ | |||
1614 | 779 | try: | 779 | try: |
1615 | 780 | copies = tuple(copied) | 780 | copies = tuple(copied) |
1616 | 781 | except TypeError: | 781 | except TypeError: |
1618 | 782 | copies = (copied,) | 782 | copies = (copied, ) |
1619 | 783 | 783 | ||
1620 | 784 | for copy in copies: | 784 | for copy in copies: |
1621 | 785 | self.assertEquals(copy.component, pub_record.component) | 785 | self.assertEquals(copy.component, pub_record.component) |
1622 | @@ -889,7 +889,8 @@ | |||
1623 | 889 | """Return a mock source package publishing record for the archive | 889 | """Return a mock source package publishing record for the archive |
1624 | 890 | and architecture used in this testcase. | 890 | and architecture used in this testcase. |
1625 | 891 | 891 | ||
1627 | 892 | :param architecturehintlist: Architecture hint list (e.g. "i386 amd64") | 892 | :param architecturehintlist: Architecture hint list |
1628 | 893 | (e.g. "i386 amd64") | ||
1629 | 893 | """ | 894 | """ |
1630 | 894 | return super(BuildRecordCreationTests, self).getPubSource( | 895 | return super(BuildRecordCreationTests, self).getPubSource( |
1631 | 895 | archive=self.archive, distroseries=self.distroseries, | 896 | archive=self.archive, distroseries=self.distroseries, |
1632 | @@ -929,8 +930,8 @@ | |||
1633 | 929 | self.assertEquals(self.sparc_distroarch, builds[0].distro_arch_series) | 930 | self.assertEquals(self.sparc_distroarch, builds[0].distro_arch_series) |
1634 | 930 | 931 | ||
1635 | 931 | def test_createMissingBuilds_restricts_explicitlist(self): | 932 | def test_createMissingBuilds_restricts_explicitlist(self): |
1638 | 932 | """createMissingBuilds() should limit builds targeted at a | 933 | """createMissingBuilds() limits builds targeted at a variety of |
1639 | 933 | variety of architectures architecture to those allowed for the archive. | 934 | architectures architecture to those allowed for the archive. |
1640 | 934 | """ | 935 | """ |
1641 | 935 | pubrec = self.getPubSource(architecturehintlist='sparc i386 avr') | 936 | pubrec = self.getPubSource(architecturehintlist='sparc i386 avr') |
1642 | 936 | builds = pubrec.createMissingBuilds() | 937 | builds = pubrec.createMissingBuilds() |
1643 | @@ -1014,7 +1015,3 @@ | |||
1644 | 1014 | record = self.publishing_set.getByIdAndArchive( | 1015 | record = self.publishing_set.getByIdAndArchive( |
1645 | 1015 | binary_publishing.id, wrong_archive, source=False) | 1016 | binary_publishing.id, wrong_archive, source=False) |
1646 | 1016 | self.assertEqual(None, record) | 1017 | self.assertEqual(None, record) |
1647 | 1017 | |||
1648 | 1018 | |||
1649 | 1019 | def test_suite(): | ||
1650 | 1020 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1651 | 1021 | 1018 | ||
1652 | === modified file 'lib/lp/soyuz/tests/test_publishing_models.py' | |||
1653 | --- lib/lp/soyuz/tests/test_publishing_models.py 2010-05-05 14:50:42 +0000 | |||
1654 | +++ lib/lp/soyuz/tests/test_publishing_models.py 2010-07-21 07:48:48 +0000 | |||
1655 | @@ -1,10 +1,8 @@ | |||
1657 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1658 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1659 | 3 | 3 | ||
1660 | 4 | """Test model and set utilities used for publishing.""" | 4 | """Test model and set utilities used for publishing.""" |
1661 | 5 | 5 | ||
1662 | 6 | import unittest | ||
1663 | 7 | |||
1664 | 8 | from zope.component import getUtility | 6 | from zope.component import getUtility |
1665 | 9 | from zope.security.proxy import removeSecurityProxy | 7 | from zope.security.proxy import removeSecurityProxy |
1666 | 10 | 8 | ||
1667 | @@ -86,9 +84,6 @@ | |||
1668 | 86 | self.assertEqual(urls, [ | 84 | self.assertEqual(urls, [ |
1669 | 87 | 'http://localhost:58000/94/gedit_666_source.changes', | 85 | 'http://localhost:58000/94/gedit_666_source.changes', |
1670 | 88 | 'http://localhost:58000/96/firefox_666_source.changes', | 86 | 'http://localhost:58000/96/firefox_666_source.changes', |
1672 | 89 | 'http://localhost:58000/98/getting-things-gnome_666_source.changes' | 87 | ('http://localhost:58000/98/' |
1673 | 88 | 'getting-things-gnome_666_source.changes'), | ||
1674 | 90 | ]) | 89 | ]) |
1675 | 91 | |||
1676 | 92 | |||
1677 | 93 | def test_suite(): | ||
1678 | 94 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
1679 | 95 | 90 | ||
1680 | === modified file 'lib/lp/soyuz/tests/test_publishing_top_level_api.py' | |||
1681 | --- lib/lp/soyuz/tests/test_publishing_top_level_api.py 2009-12-13 11:55:40 +0000 | |||
1682 | +++ lib/lp/soyuz/tests/test_publishing_top_level_api.py 2010-07-21 07:48:48 +0000 | |||
1683 | @@ -1,10 +1,8 @@ | |||
1685 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1686 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1687 | 3 | 3 | ||
1688 | 4 | """Test top-level publication API in Soyuz.""" | 4 | """Test top-level publication API in Soyuz.""" |
1689 | 5 | 5 | ||
1690 | 6 | from unittest import TestLoader | ||
1691 | 7 | |||
1692 | 8 | from lp.soyuz.tests.test_publishing import TestNativePublishingBase | 6 | from lp.soyuz.tests.test_publishing import TestNativePublishingBase |
1693 | 9 | 7 | ||
1694 | 10 | from lp.registry.interfaces.series import SeriesStatus | 8 | from lp.registry.interfaces.series import SeriesStatus |
1695 | @@ -118,7 +116,7 @@ | |||
1696 | 118 | 116 | ||
1697 | 119 | # source and binary PUBLISHED on disk. | 117 | # source and binary PUBLISHED on disk. |
1698 | 120 | foo_dsc = "%s/main/f/foo/foo_666.dsc" % self.pool_dir | 118 | foo_dsc = "%s/main/f/foo/foo_666.dsc" % self.pool_dir |
1700 | 121 | self.assertEqual(open(foo_dsc).read().strip(),'Hello') | 119 | self.assertEqual(open(foo_dsc).read().strip(), 'Hello') |
1701 | 122 | foo_deb = "%s/main/f/foo/foo-bin_666_all.deb" % self.pool_dir | 120 | foo_deb = "%s/main/f/foo/foo-bin_666_all.deb" % self.pool_dir |
1702 | 123 | self.assertEqual(open(foo_deb).read().strip(), 'World') | 121 | self.assertEqual(open(foo_deb).read().strip(), 'World') |
1703 | 124 | 122 | ||
1704 | @@ -207,8 +205,9 @@ | |||
1705 | 207 | def testPublicationLookUpForUnstableDistroSeries(self): | 205 | def testPublicationLookUpForUnstableDistroSeries(self): |
1706 | 208 | """Source publishing record lookup for a unstable DistroSeries. | 206 | """Source publishing record lookup for a unstable DistroSeries. |
1707 | 209 | 207 | ||
1710 | 210 | Check if the ICanPublishPackages.getPendingPublications() works properly | 208 | Check if the ICanPublishPackages.getPendingPublications() works |
1711 | 211 | for a DistroSeries when it is still in development, 'unreleased'. | 209 | properly for a DistroSeries when it is still in development, |
1712 | 210 | 'unreleased'. | ||
1713 | 212 | """ | 211 | """ |
1714 | 213 | pub_pending_release, pub_published_release, pub_pending_updates = ( | 212 | pub_pending_release, pub_published_release, pub_pending_updates = ( |
1715 | 214 | self._createDefaulSourcePublications()) | 213 | self._createDefaulSourcePublications()) |
1716 | @@ -241,9 +240,9 @@ | |||
1717 | 241 | def testPublicationLookUpForStableDistroSeries(self): | 240 | def testPublicationLookUpForStableDistroSeries(self): |
1718 | 242 | """Source publishing record lookup for a stable/released DistroSeries. | 241 | """Source publishing record lookup for a stable/released DistroSeries. |
1719 | 243 | 242 | ||
1723 | 244 | Check if the ICanPublishPackages.getPendingPublications() works properly | 243 | Check if the ICanPublishPackages.getPendingPublications() works |
1724 | 245 | for a DistroSeries when it is not in development anymore, i.e., | 244 | properly for a DistroSeries when it is not in development anymore, |
1725 | 246 | 'released'. | 245 | i.e., 'released'. |
1726 | 247 | """ | 246 | """ |
1727 | 248 | pub_pending_release, pub_published_release, pub_pending_updates = ( | 247 | pub_pending_release, pub_published_release, pub_pending_updates = ( |
1728 | 249 | self._createDefaulSourcePublications()) | 248 | self._createDefaulSourcePublications()) |
1729 | @@ -276,8 +275,8 @@ | |||
1730 | 276 | def testPublicationLookUpForFrozenDistroSeries(self): | 275 | def testPublicationLookUpForFrozenDistroSeries(self): |
1731 | 277 | """Source publishing record lookup for a frozen DistroSeries. | 276 | """Source publishing record lookup for a frozen DistroSeries. |
1732 | 278 | 277 | ||
1735 | 279 | Check if the ICanPublishPackages.getPendingPubliations() works properly | 278 | Check if the ICanPublishPackages.getPendingPubliations() works |
1736 | 280 | for a DistroSeries when it is in FROZEN state. | 279 | properly for a DistroSeries when it is in FROZEN state. |
1737 | 281 | """ | 280 | """ |
1738 | 282 | pub_pending_release, pub_published_release, pub_pending_updates = ( | 281 | pub_pending_release, pub_published_release, pub_pending_updates = ( |
1739 | 283 | self._createDefaulSourcePublications()) | 282 | self._createDefaulSourcePublications()) |
1740 | @@ -313,9 +312,9 @@ | |||
1741 | 313 | def testPublicationLookUpForUnstableDistroArchSeries(self): | 312 | def testPublicationLookUpForUnstableDistroArchSeries(self): |
1742 | 314 | """Binary publishing record lookup for a unstable DistroArchSeries. | 313 | """Binary publishing record lookup for a unstable DistroArchSeries. |
1743 | 315 | 314 | ||
1747 | 316 | Check if the ICanPublishPackages.getPendingPublications() works properly | 315 | Check if the ICanPublishPackages.getPendingPublications() works |
1748 | 317 | for a DistroArchSeries when it is still in DEVELOPMENT, i.e., | 316 | properly for a DistroArchSeries when it is still in DEVELOPMENT, |
1749 | 318 | 'unstable'. | 317 | i.e., 'unstable'. |
1750 | 319 | """ | 318 | """ |
1751 | 320 | pub_pending_release, pub_published_release, pub_pending_updates = ( | 319 | pub_pending_release, pub_published_release, pub_pending_updates = ( |
1752 | 321 | self._createDefaulBinaryPublications()) | 320 | self._createDefaulBinaryPublications()) |
1753 | @@ -421,7 +420,3 @@ | |||
1754 | 421 | self.checkBinaryLookupForPocket( | 420 | self.checkBinaryLookupForPocket( |
1755 | 422 | PackagePublishingPocket.RELEASE, is_careful=True, | 421 | PackagePublishingPocket.RELEASE, is_careful=True, |
1756 | 423 | expected_result=[pub_published_release, pub_pending_release]) | 422 | expected_result=[pub_published_release, pub_pending_release]) |
1757 | 424 | |||
1758 | 425 | |||
1759 | 426 | def test_suite(): | ||
1760 | 427 | return TestLoader().loadTestsFromName(__name__) | ||
1761 | 428 | 423 | ||
1762 | === modified file 'lib/lp/testing/faketransaction.py' | |||
1763 | --- lib/lp/testing/faketransaction.py 2010-02-23 23:26:15 +0000 | |||
1764 | +++ lib/lp/testing/faketransaction.py 2010-07-21 07:48:48 +0000 | |||
1765 | @@ -15,6 +15,8 @@ | |||
1766 | 15 | 15 | ||
1767 | 16 | Set `log_calls` to True to enable printing of commits and aborts. | 16 | Set `log_calls` to True to enable printing of commits and aborts. |
1768 | 17 | """ | 17 | """ |
1769 | 18 | commit_count = 0 | ||
1770 | 19 | |||
1771 | 18 | def __init__(self, log_calls=False): | 20 | def __init__(self, log_calls=False): |
1772 | 19 | self.log_calls = log_calls | 21 | self.log_calls = log_calls |
1773 | 20 | 22 | ||
1774 | @@ -28,6 +30,7 @@ | |||
1775 | 28 | 30 | ||
1776 | 29 | def commit(self): | 31 | def commit(self): |
1777 | 30 | """Pretend to commit.""" | 32 | """Pretend to commit.""" |
1778 | 33 | self.commit_count += 1 | ||
1779 | 31 | self._log("COMMIT") | 34 | self._log("COMMIT") |
1780 | 32 | 35 | ||
1781 | 33 | def abort(self): | 36 | def abort(self): |
+1