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

+1