Merge lp:~cjwatson/launchpad/quieten-tests into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18383
Proposed branch: lp:~cjwatson/launchpad/quieten-tests
Merge into: lp:launchpad
Diff against target: 447 lines (+55/-25)
14 files modified
lib/lp/app/tests/test_services.py (+4/-1)
lib/lp/blueprints/browser/tests/test_specification.py (+3/-1)
lib/lp/bugs/model/tests/test_bugtask.py (+4/-4)
lib/lp/code/browser/tests/test_branch.py (+3/-1)
lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+5/-1)
lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py (+4/-1)
lib/lp/registry/browser/tests/test_packaging.py (+3/-6)
lib/lp/registry/browser/tests/test_person.py (+6/-3)
lib/lp/registry/browser/tests/test_reassign_team_view.py (+3/-1)
lib/lp/services/features/browser/tests/test_feature_editor.py (+6/-1)
lib/lp/services/webapp/tests/test_publication.py (+4/-1)
lib/lp/translations/browser/tests/test_distribution_views.py (+3/-1)
lib/lp/translations/scripts/tests/test_remove_translations.py (+4/-2)
lib/lp/translations/tests/test_autoapproval.py (+3/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad/quieten-tests
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+323918@code.launchpad.net

Commit message

Quieten some tests with noisy output.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/app/tests/test_services.py'
2--- lib/lp/app/tests/test_services.py 2015-07-08 16:05:11 +0000
3+++ lib/lp/app/tests/test_services.py 2017-05-11 14:53:15 +0000
4@@ -1,8 +1,9 @@
5-# Copyright 2012 Canonical Ltd. This software is licensed under the
6+# Copyright 2012-2017 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9 """Tests for core services infrastructure."""
10
11+from fixtures import FakeLogger
12 from lazr.restful.interfaces._rest import IHTTPResource
13 from zope.component import getUtility
14 from zope.interface import implementer
15@@ -49,12 +50,14 @@
16
17 def test_invalid_traversal(self):
18 # Test that traversal to +services without a service specified fails.
19+ self.useFixture(FakeLogger())
20 self.assertRaises(
21 NotFound, self.getUserBrowser,
22 'https://launchpad.dev/api/devel/+services')
23
24 def test_invalid_service(self):
25 # Test that traversal an invalid service name fails.
26+ self.useFixture(FakeLogger())
27 self.assertRaises(
28 NotFound, self.getUserBrowser,
29 'https://launchpad.dev/api/devel/+services/invalid')
30
31=== modified file 'lib/lp/blueprints/browser/tests/test_specification.py'
32--- lib/lp/blueprints/browser/tests/test_specification.py 2015-06-25 07:39:40 +0000
33+++ lib/lp/blueprints/browser/tests/test_specification.py 2017-05-11 14:53:15 +0000
34@@ -1,4 +1,4 @@
35-# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
36+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
37 # GNU Affero General Public License version 3 (see the file LICENSE).
38
39 __metaclass__ = type
40@@ -9,6 +9,7 @@
41 import unittest
42
43 from BeautifulSoup import BeautifulSoup
44+from fixtures import FakeLogger
45 from lazr.restful.interfaces import IJSONRequestCache
46 import pytz
47 import soupmatchers
48@@ -187,6 +188,7 @@
49 def test_private_specification_without_authorization(self):
50 # Users without access get a 404 when trying to view private
51 # specifications.
52+ self.useFixture(FakeLogger())
53 owner = self.factory.makePerson()
54 policy = SpecificationSharingPolicy.PROPRIETARY
55 product = self.factory.makeProduct(owner=owner,
56
57=== modified file 'lib/lp/bugs/model/tests/test_bugtask.py'
58--- lib/lp/bugs/model/tests/test_bugtask.py 2016-05-05 08:23:13 +0000
59+++ lib/lp/bugs/model/tests/test_bugtask.py 2017-05-11 14:53:15 +0000
60@@ -1,4 +1,4 @@
61-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
62+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
63 # GNU Affero General Public License version 3 (see the file LICENSE).
64
65 __metaclass__ = type
66@@ -84,7 +84,7 @@
67 )
68 from lp.services.features.testing import FeatureFixture
69 from lp.services.job.tests import block_on_job
70-from lp.services.log.logger import FakeLogger
71+from lp.services.log.logger import DevNullLogger
72 from lp.services.propertycache import get_property_cache
73 from lp.services.searchbuilder import any
74 from lp.services.webapp.authorization import check_permission
75@@ -3154,7 +3154,7 @@
76 "/var/lock/launchpad-launchpad-targetnamecacheupdater.lock")))
77 self.assertTrue('INFO Updating targetname cache of bugtasks' in err)
78 self.assertTrue('INFO Calculating targets.' in err)
79- self.assertTrue('INFO Will check ', err)
80+ self.assertTrue('INFO Will check ' in err)
81 self.assertTrue("INFO Updating (u'Mozilla Thunderbird',)" in err)
82 self.assertTrue('INFO Updated 1 target names.' in err)
83 self.assertTrue('INFO Finished updating targetname cache' in err)
84@@ -3218,7 +3218,7 @@
85 self.assertEqual(upstream_task.bugtargetdisplayname,
86 u'Mozilla Thunderbird NG')
87
88- logger = FakeLogger()
89+ logger = DevNullLogger()
90 updater = BugTaskTargetNameCacheUpdater(transaction, logger)
91 updater.run()
92
93
94=== modified file 'lib/lp/code/browser/tests/test_branch.py'
95--- lib/lp/code/browser/tests/test_branch.py 2016-11-11 14:24:38 +0000
96+++ lib/lp/code/browser/tests/test_branch.py 2017-05-11 14:53:15 +0000
97@@ -1,4 +1,4 @@
98-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
99+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
100 # GNU Affero General Public License version 3 (see the file LICENSE).
101
102 """Unit tests for BranchView."""
103@@ -9,6 +9,7 @@
104 from textwrap import dedent
105
106 from BeautifulSoup import BeautifulSoup
107+from fixtures import FakeLogger
108 import pytz
109 from storm.store import Store
110 from testtools.matchers import Equals
111@@ -664,6 +665,7 @@
112
113 def test_anonymous_view_branch_with_private_owner(self):
114 # A branch with a private owner is not rendered for anon users.
115+ self.useFixture(FakeLogger())
116 private_owner = self.factory.makeTeam(
117 visibility=PersonVisibility.PRIVATE)
118 with person_logged_in(private_owner):
119
120=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
121--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2016-10-14 16:16:18 +0000
122+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2017-05-11 14:53:15 +0000
123@@ -1,4 +1,4 @@
124-# Copyright 2010-2016 Canonical Ltd. This software is licensed under the
125+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
126 # GNU Affero General Public License version 3 (see the file LICENSE).
127
128 """Tests for the source package recipe view classes and templates."""
129@@ -14,6 +14,7 @@
130 from textwrap import dedent
131
132 from BeautifulSoup import BeautifulSoup
133+from fixtures import FakeLogger
134 from mechanize import LinkNotFoundError
135 from pytz import UTC
136 from testtools.matchers import Equals
137@@ -390,6 +391,7 @@
138 layer = DatabaseFunctionalLayer
139
140 def test_create_new_recipe_not_logged_in(self):
141+ self.useFixture(FakeLogger())
142 product = self.factory.makeProduct(
143 name='ratatouille', displayname='Ratatouille')
144 branch = self.makeBranch(
145@@ -1576,6 +1578,7 @@
146
147 def test_request_builds_action_not_logged_in(self):
148 """Requesting a build creates pending builds."""
149+ self.useFixture(FakeLogger())
150 self._makeWoodyDistroSeries()
151 recipe = self.makeRecipe()
152 browser = self.getViewBrowser(recipe, no_login=True)
153@@ -1927,6 +1930,7 @@
154 browser.url)
155
156 def test_delete_recipe_no_permissions(self):
157+ self.useFixture(FakeLogger())
158 branch = self.makeBranch()
159 recipe = self.factory.makeSourcePackageRecipe(
160 owner=self.chef, branches=[branch])
161
162=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py'
163--- lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py 2015-09-11 14:23:02 +0000
164+++ lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py 2017-05-11 14:53:15 +0000
165@@ -1,9 +1,10 @@
166-# Copyright 2010 Canonical Ltd. This software is licensed under the
167+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
168 # GNU Affero General Public License version 3 (see the file LICENSE).
169 """Tests for the source package recipe view classes and templates."""
170
171 __metaclass__ = type
172
173+from fixtures import FakeLogger
174 from mechanize import LinkNotFoundError
175 from storm.locals import Store
176 from testtools.matchers import StartsWith
177@@ -112,6 +113,7 @@
178
179 def test_cancel_build_not_owner(self):
180 """A normal user can't cancel a build."""
181+ self.useFixture(FakeLogger())
182 queue = self.factory.makeSourcePackageRecipeBuild().queueBuild()
183 build = queue.specific_build
184 transaction.commit()
185@@ -195,6 +197,7 @@
186
187 def test_rescore_build_not_admin(self):
188 """No one but admin can rescore a build."""
189+ self.useFixture(FakeLogger())
190 queue = self.factory.makeSourcePackageRecipeBuild().queueBuild()
191 build = queue.specific_build
192 transaction.commit()
193
194=== modified file 'lib/lp/registry/browser/tests/test_packaging.py'
195--- lib/lp/registry/browser/tests/test_packaging.py 2016-09-09 16:51:36 +0000
196+++ lib/lp/registry/browser/tests/test_packaging.py 2017-05-11 14:53:15 +0000
197@@ -1,4 +1,4 @@
198-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
199+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
200 # GNU Affero General Public License version 3 (see the file LICENSE).
201
202 """Browser tests for Packaging actions."""
203@@ -25,10 +25,7 @@
204 logout,
205 TestCaseWithFactory,
206 )
207-from lp.testing.layers import (
208- DatabaseFunctionalLayer,
209- PageTestLayer,
210- )
211+from lp.testing.layers import DatabaseFunctionalLayer
212 from lp.testing.pages import setupBrowser
213 from lp.testing.views import create_initialized_view
214
215@@ -152,7 +149,7 @@
216 class TestBrowserDeletePackaging(TestCaseWithFactory):
217 """Browser tests for deletion of Packaging objects."""
218
219- layer = PageTestLayer
220+ layer = DatabaseFunctionalLayer
221
222 def setUp(self):
223 super(TestBrowserDeletePackaging, self).setUp()
224
225=== modified file 'lib/lp/registry/browser/tests/test_person.py'
226--- lib/lp/registry/browser/tests/test_person.py 2017-04-22 13:13:22 +0000
227+++ lib/lp/registry/browser/tests/test_person.py 2017-05-11 14:53:15 +0000
228@@ -8,6 +8,7 @@
229 import re
230 from textwrap import dedent
231
232+from fixtures import FakeLogger
233 import soupmatchers
234 from storm.store import Store
235 from testtools.matchers import (
236@@ -44,7 +45,7 @@
237 from lp.services.config import config
238 from lp.services.identity.interfaces.account import AccountStatus
239 from lp.services.identity.interfaces.emailaddress import IEmailAddressSet
240-from lp.services.log.logger import FakeLogger
241+from lp.services.log.logger import DevNullLogger
242 from lp.services.mail import stub
243 from lp.services.propertycache import clear_property_cache
244 from lp.services.verification.interfaces.authtoken import LoginTokenType
245@@ -747,6 +748,7 @@
246
247 def test_team_editemails_not_found(self):
248 """Teams should not have a +editemails page."""
249+ self.useFixture(FakeLogger())
250 team = self.factory.makeTeam(owner=self.person, members=[self.person])
251 url = '%s/+editemails' % canonical_url(team)
252 browser = setupBrowserForUser(user=self.person)
253@@ -754,6 +756,7 @@
254
255 def test_team_editmailinglists_not_found(self):
256 """Teams should not have a +editmailinglists page."""
257+ self.useFixture(FakeLogger())
258 team = self.factory.makeTeam(owner=self.person, members=[self.person])
259 url = '%s/+editmailinglists' % canonical_url(team)
260 browser = setupBrowserForUser(user=self.person)
261@@ -998,7 +1001,7 @@
262 spphs.append(spph)
263 # Update the releases cache table.
264 switch_dbuser('garbo_frequently')
265- job = PopulateLatestPersonSourcePackageReleaseCache(FakeLogger())
266+ job = PopulateLatestPersonSourcePackageReleaseCache(DevNullLogger())
267 while not job.isDone():
268 job(chunk_size=100)
269 switch_dbuser('launchpad')
270@@ -1258,7 +1261,7 @@
271 self.build.updateStatus(BuildStatus.FAILEDTOBUILD)
272 # Update the releases cache table.
273 switch_dbuser('garbo_frequently')
274- job = PopulateLatestPersonSourcePackageReleaseCache(FakeLogger())
275+ job = PopulateLatestPersonSourcePackageReleaseCache(DevNullLogger())
276 while not job.isDone():
277 job(chunk_size=100)
278 switch_dbuser('launchpad')
279
280=== modified file 'lib/lp/registry/browser/tests/test_reassign_team_view.py'
281--- lib/lp/registry/browser/tests/test_reassign_team_view.py 2012-12-10 13:43:47 +0000
282+++ lib/lp/registry/browser/tests/test_reassign_team_view.py 2017-05-11 14:53:15 +0000
283@@ -1,10 +1,11 @@
284-# Copyright 2011 Canonical Ltd. This software is licensed under the
285+# Copyright 2011-2017 Canonical Ltd. This software is licensed under the
286 # GNU Affero General Public License version 3 (see the file LICENSE).
287
288 """Tests for TeamReassignmentView view code."""
289
290 __metaclass__ = type
291
292+from fixtures import FakeLogger
293 from zope.component import getUtility
294 from zope.security.interfaces import Unauthorized
295 from zope.security.proxy import removeSecurityProxy
296@@ -31,6 +32,7 @@
297
298 def test_non_owner_unauthorised(self):
299 # Only team owners can reassign team ownership.
300+ self.useFixture(FakeLogger())
301 team = self.factory.makeTeam()
302 any_person = self.factory.makePerson()
303 reassign_url = canonical_url(team, view_name='+reassign')
304
305=== modified file 'lib/lp/services/features/browser/tests/test_feature_editor.py'
306--- lib/lp/services/features/browser/tests/test_feature_editor.py 2014-02-27 05:26:26 +0000
307+++ lib/lp/services/features/browser/tests/test_feature_editor.py 2017-05-11 14:53:15 +0000
308@@ -1,4 +1,4 @@
309-# Copyright 2010 Canonical Ltd. This software is licensed under the
310+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
311 # GNU Affero General Public License version 3 (see the file LICENSE).
312
313 """Tests for feature rule editor"""
314@@ -7,6 +7,7 @@
315
316 from textwrap import dedent
317
318+from fixtures import FakeLogger
319 from testtools.matchers import Equals
320 from zope.component import getUtility
321 from zope.security.interfaces import Unauthorized
322@@ -39,6 +40,10 @@
323
324 layer = DatabaseFunctionalLayer
325
326+ def setUp(self):
327+ super(TestFeatureControlPage, self).setUp()
328+ self.useFixture(FakeLogger())
329+
330 def getUserBrowserAsTeamMember(self, teams):
331 """Make a TestBrowser authenticated as a team member.
332
333
334=== modified file 'lib/lp/services/webapp/tests/test_publication.py'
335--- lib/lp/services/webapp/tests/test_publication.py 2016-01-26 15:14:01 +0000
336+++ lib/lp/services/webapp/tests/test_publication.py 2017-05-11 14:53:15 +0000
337@@ -1,4 +1,4 @@
338-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
339+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
340 # GNU Affero General Public License version 3 (see the file LICENSE).
341
342 """Tests publication.py"""
343@@ -13,6 +13,7 @@
344 OAuthSignatureMethod_PLAINTEXT,
345 OAuthToken,
346 )
347+from fixtures import FakeLogger
348 from storm.database import (
349 STATE_DISCONNECTED,
350 STATE_RECONNECT,
351@@ -282,6 +283,7 @@
352 def test_not_found(self):
353 # No oopses are reported when accessing the referer while rendering
354 # the page.
355+ self.useFixture(FakeLogger())
356 browser = self.getUserBrowser()
357 browser.addHeader('Referer', '/whut\xe7foo')
358 self.assertRaises(
359@@ -298,6 +300,7 @@
360 def test_non_ascii_url(self):
361 # No oopses are reported when accessing the URL while rendering the
362 # page.
363+ self.useFixture(FakeLogger())
364 browser = self.getUserBrowser()
365 self.assertRaises(
366 NotFound,
367
368=== modified file 'lib/lp/translations/browser/tests/test_distribution_views.py'
369--- lib/lp/translations/browser/tests/test_distribution_views.py 2012-01-01 02:58:52 +0000
370+++ lib/lp/translations/browser/tests/test_distribution_views.py 2017-05-11 14:53:15 +0000
371@@ -1,10 +1,11 @@
372-# Copyright 2011 Canonical Ltd. This software is licensed under the
373+# Copyright 2011-2017 Canonical Ltd. This software is licensed under the
374 # GNU Affero General Public License version 3 (see the file LICENSE).
375
376 """Tests for the translations views on a distroseries."""
377
378 __metaclass__ = type
379
380+from fixtures import FakeLogger
381 from zope.security.interfaces import Unauthorized
382
383 from lp.services.webapp import canonical_url
384@@ -38,6 +39,7 @@
385 def test_unprivileged_users(self):
386 # Unprivileged users cannot access distribution translation settings
387 # page Distribution:+configure-translations.
388+ self.useFixture(FakeLogger())
389 unprivileged = self.factory.makePerson()
390 distribution = self.factory.makeDistribution()
391 browser = self.getUserBrowser(user=unprivileged)
392
393=== modified file 'lib/lp/translations/scripts/tests/test_remove_translations.py'
394--- lib/lp/translations/scripts/tests/test_remove_translations.py 2014-12-08 23:42:47 +0000
395+++ lib/lp/translations/scripts/tests/test_remove_translations.py 2017-05-11 14:53:15 +0000
396@@ -1,6 +1,6 @@
397 #! /usr/bin/python
398 #
399-# Copyright 2009 Canonical Ltd. This software is licensed under the
400+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
401 # GNU Affero General Public License version 3 (see the file LICENSE).
402
403 """Test `remove_translations` and the `RemoveTranslations` script."""
404@@ -21,6 +21,7 @@
405 from zope.testing.loghandler import Handler
406
407 from lp.registry.interfaces.person import IPersonSet
408+from lp.services.log.logger import DevNullLogger
409 from lp.services.scripts.base import LaunchpadScriptFailure
410 from lp.testing import (
411 TestCase,
412@@ -46,7 +47,8 @@
413 """Create a `RemoveTranslations` script with given options."""
414 if isinstance(args, basestring):
415 args = [args]
416- script = RemoveTranslations('remove-translations-test', test_args=args)
417+ script = RemoveTranslations(
418+ 'remove-translations-test', test_args=args, logger=DevNullLogger())
419 return script
420
421
422
423=== modified file 'lib/lp/translations/tests/test_autoapproval.py'
424--- lib/lp/translations/tests/test_autoapproval.py 2013-06-20 05:50:00 +0000
425+++ lib/lp/translations/tests/test_autoapproval.py 2017-05-11 14:53:15 +0000
426@@ -1,4 +1,4 @@
427-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
428+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
429 # GNU Affero General Public License version 3 (see the file LICENSE).
430
431 """Unit tests for translation import queue auto-approval.
432@@ -14,6 +14,7 @@
433 timedelta,
434 )
435
436+from fixtures import FakeLogger
437 from pytz import UTC
438 from zope.component import getUtility
439 from zope.security.proxy import removeSecurityProxy
440@@ -308,6 +309,7 @@
441
442 def setUp(self):
443 super(TestTemplateGuess, self).setUp()
444+ self.useFixture(FakeLogger())
445 self.templateset = POTemplateSet()
446
447 def _setUpProduct(self):