launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #21560
[Merge] lp:~cjwatson/launchpad/quieten-tests into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/quieten-tests into lp:launchpad.
Commit message:
Quieten some tests with noisy output.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/quieten-tests/+merge/323918
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/quieten-tests into lp:launchpad.
=== modified file 'lib/lp/app/tests/test_services.py'
--- lib/lp/app/tests/test_services.py 2015-07-08 16:05:11 +0000
+++ lib/lp/app/tests/test_services.py 2017-05-11 14:53:15 +0000
@@ -1,8 +1,9 @@
-# Copyright 2012 Canonical Ltd. This software is licensed under the
+# Copyright 2012-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for core services infrastructure."""
+from fixtures import FakeLogger
from lazr.restful.interfaces._rest import IHTTPResource
from zope.component import getUtility
from zope.interface import implementer
@@ -49,12 +50,14 @@
def test_invalid_traversal(self):
# Test that traversal to +services without a service specified fails.
+ self.useFixture(FakeLogger())
self.assertRaises(
NotFound, self.getUserBrowser,
'https://launchpad.dev/api/devel/+services')
def test_invalid_service(self):
# Test that traversal an invalid service name fails.
+ self.useFixture(FakeLogger())
self.assertRaises(
NotFound, self.getUserBrowser,
'https://launchpad.dev/api/devel/+services/invalid')
=== modified file 'lib/lp/blueprints/browser/tests/test_specification.py'
--- lib/lp/blueprints/browser/tests/test_specification.py 2015-06-25 07:39:40 +0000
+++ lib/lp/blueprints/browser/tests/test_specification.py 2017-05-11 14:53:15 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -9,6 +9,7 @@
import unittest
from BeautifulSoup import BeautifulSoup
+from fixtures import FakeLogger
from lazr.restful.interfaces import IJSONRequestCache
import pytz
import soupmatchers
@@ -187,6 +188,7 @@
def test_private_specification_without_authorization(self):
# Users without access get a 404 when trying to view private
# specifications.
+ self.useFixture(FakeLogger())
owner = self.factory.makePerson()
policy = SpecificationSharingPolicy.PROPRIETARY
product = self.factory.makeProduct(owner=owner,
=== modified file 'lib/lp/bugs/model/tests/test_bugtask.py'
--- lib/lp/bugs/model/tests/test_bugtask.py 2016-05-05 08:23:13 +0000
+++ lib/lp/bugs/model/tests/test_bugtask.py 2017-05-11 14:53:15 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -84,7 +84,7 @@
)
from lp.services.features.testing import FeatureFixture
from lp.services.job.tests import block_on_job
-from lp.services.log.logger import FakeLogger
+from lp.services.log.logger import DevNullLogger
from lp.services.propertycache import get_property_cache
from lp.services.searchbuilder import any
from lp.services.webapp.authorization import check_permission
@@ -3154,7 +3154,7 @@
"/var/lock/launchpad-launchpad-targetnamecacheupdater.lock")))
self.assertTrue('INFO Updating targetname cache of bugtasks' in err)
self.assertTrue('INFO Calculating targets.' in err)
- self.assertTrue('INFO Will check ', err)
+ self.assertTrue('INFO Will check ' in err)
self.assertTrue("INFO Updating (u'Mozilla Thunderbird',)" in err)
self.assertTrue('INFO Updated 1 target names.' in err)
self.assertTrue('INFO Finished updating targetname cache' in err)
@@ -3218,7 +3218,7 @@
self.assertEqual(upstream_task.bugtargetdisplayname,
u'Mozilla Thunderbird NG')
- logger = FakeLogger()
+ logger = DevNullLogger()
updater = BugTaskTargetNameCacheUpdater(transaction, logger)
updater.run()
=== modified file 'lib/lp/code/browser/tests/test_branch.py'
--- lib/lp/code/browser/tests/test_branch.py 2016-11-11 14:24:38 +0000
+++ lib/lp/code/browser/tests/test_branch.py 2017-05-11 14:53:15 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Unit tests for BranchView."""
@@ -9,6 +9,7 @@
from textwrap import dedent
from BeautifulSoup import BeautifulSoup
+from fixtures import FakeLogger
import pytz
from storm.store import Store
from testtools.matchers import Equals
@@ -664,6 +665,7 @@
def test_anonymous_view_branch_with_private_owner(self):
# A branch with a private owner is not rendered for anon users.
+ self.useFixture(FakeLogger())
private_owner = self.factory.makeTeam(
visibility=PersonVisibility.PRIVATE)
with person_logged_in(private_owner):
=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2016-10-14 16:16:18 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2017-05-11 14:53:15 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2016 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the source package recipe view classes and templates."""
@@ -14,6 +14,7 @@
from textwrap import dedent
from BeautifulSoup import BeautifulSoup
+from fixtures import FakeLogger
from mechanize import LinkNotFoundError
from pytz import UTC
from testtools.matchers import Equals
@@ -390,6 +391,7 @@
layer = DatabaseFunctionalLayer
def test_create_new_recipe_not_logged_in(self):
+ self.useFixture(FakeLogger())
product = self.factory.makeProduct(
name='ratatouille', displayname='Ratatouille')
branch = self.makeBranch(
@@ -1576,6 +1578,7 @@
def test_request_builds_action_not_logged_in(self):
"""Requesting a build creates pending builds."""
+ self.useFixture(FakeLogger())
self._makeWoodyDistroSeries()
recipe = self.makeRecipe()
browser = self.getViewBrowser(recipe, no_login=True)
@@ -1927,6 +1930,7 @@
browser.url)
def test_delete_recipe_no_permissions(self):
+ self.useFixture(FakeLogger())
branch = self.makeBranch()
recipe = self.factory.makeSourcePackageRecipe(
owner=self.chef, branches=[branch])
=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py 2015-09-11 14:23:02 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py 2017-05-11 14:53:15 +0000
@@ -1,9 +1,10 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the source package recipe view classes and templates."""
__metaclass__ = type
+from fixtures import FakeLogger
from mechanize import LinkNotFoundError
from storm.locals import Store
from testtools.matchers import StartsWith
@@ -112,6 +113,7 @@
def test_cancel_build_not_owner(self):
"""A normal user can't cancel a build."""
+ self.useFixture(FakeLogger())
queue = self.factory.makeSourcePackageRecipeBuild().queueBuild()
build = queue.specific_build
transaction.commit()
@@ -195,6 +197,7 @@
def test_rescore_build_not_admin(self):
"""No one but admin can rescore a build."""
+ self.useFixture(FakeLogger())
queue = self.factory.makeSourcePackageRecipeBuild().queueBuild()
build = queue.specific_build
transaction.commit()
=== modified file 'lib/lp/registry/browser/tests/test_packaging.py'
--- lib/lp/registry/browser/tests/test_packaging.py 2016-09-09 16:51:36 +0000
+++ lib/lp/registry/browser/tests/test_packaging.py 2017-05-11 14:53:15 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Browser tests for Packaging actions."""
@@ -25,10 +25,7 @@
logout,
TestCaseWithFactory,
)
-from lp.testing.layers import (
- DatabaseFunctionalLayer,
- PageTestLayer,
- )
+from lp.testing.layers import DatabaseFunctionalLayer
from lp.testing.pages import setupBrowser
from lp.testing.views import create_initialized_view
@@ -152,7 +149,7 @@
class TestBrowserDeletePackaging(TestCaseWithFactory):
"""Browser tests for deletion of Packaging objects."""
- layer = PageTestLayer
+ layer = DatabaseFunctionalLayer
def setUp(self):
super(TestBrowserDeletePackaging, self).setUp()
=== modified file 'lib/lp/registry/browser/tests/test_person.py'
--- lib/lp/registry/browser/tests/test_person.py 2017-04-22 13:13:22 +0000
+++ lib/lp/registry/browser/tests/test_person.py 2017-05-11 14:53:15 +0000
@@ -8,6 +8,7 @@
import re
from textwrap import dedent
+from fixtures import FakeLogger
import soupmatchers
from storm.store import Store
from testtools.matchers import (
@@ -44,7 +45,7 @@
from lp.services.config import config
from lp.services.identity.interfaces.account import AccountStatus
from lp.services.identity.interfaces.emailaddress import IEmailAddressSet
-from lp.services.log.logger import FakeLogger
+from lp.services.log.logger import DevNullLogger
from lp.services.mail import stub
from lp.services.propertycache import clear_property_cache
from lp.services.verification.interfaces.authtoken import LoginTokenType
@@ -747,6 +748,7 @@
def test_team_editemails_not_found(self):
"""Teams should not have a +editemails page."""
+ self.useFixture(FakeLogger())
team = self.factory.makeTeam(owner=self.person, members=[self.person])
url = '%s/+editemails' % canonical_url(team)
browser = setupBrowserForUser(user=self.person)
@@ -754,6 +756,7 @@
def test_team_editmailinglists_not_found(self):
"""Teams should not have a +editmailinglists page."""
+ self.useFixture(FakeLogger())
team = self.factory.makeTeam(owner=self.person, members=[self.person])
url = '%s/+editmailinglists' % canonical_url(team)
browser = setupBrowserForUser(user=self.person)
@@ -998,7 +1001,7 @@
spphs.append(spph)
# Update the releases cache table.
switch_dbuser('garbo_frequently')
- job = PopulateLatestPersonSourcePackageReleaseCache(FakeLogger())
+ job = PopulateLatestPersonSourcePackageReleaseCache(DevNullLogger())
while not job.isDone():
job(chunk_size=100)
switch_dbuser('launchpad')
@@ -1258,7 +1261,7 @@
self.build.updateStatus(BuildStatus.FAILEDTOBUILD)
# Update the releases cache table.
switch_dbuser('garbo_frequently')
- job = PopulateLatestPersonSourcePackageReleaseCache(FakeLogger())
+ job = PopulateLatestPersonSourcePackageReleaseCache(DevNullLogger())
while not job.isDone():
job(chunk_size=100)
switch_dbuser('launchpad')
=== modified file 'lib/lp/registry/browser/tests/test_reassign_team_view.py'
--- lib/lp/registry/browser/tests/test_reassign_team_view.py 2012-12-10 13:43:47 +0000
+++ lib/lp/registry/browser/tests/test_reassign_team_view.py 2017-05-11 14:53:15 +0000
@@ -1,10 +1,11 @@
-# Copyright 2011 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for TeamReassignmentView view code."""
__metaclass__ = type
+from fixtures import FakeLogger
from zope.component import getUtility
from zope.security.interfaces import Unauthorized
from zope.security.proxy import removeSecurityProxy
@@ -31,6 +32,7 @@
def test_non_owner_unauthorised(self):
# Only team owners can reassign team ownership.
+ self.useFixture(FakeLogger())
team = self.factory.makeTeam()
any_person = self.factory.makePerson()
reassign_url = canonical_url(team, view_name='+reassign')
=== modified file 'lib/lp/services/features/browser/tests/test_feature_editor.py'
--- lib/lp/services/features/browser/tests/test_feature_editor.py 2014-02-27 05:26:26 +0000
+++ lib/lp/services/features/browser/tests/test_feature_editor.py 2017-05-11 14:53:15 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for feature rule editor"""
@@ -7,6 +7,7 @@
from textwrap import dedent
+from fixtures import FakeLogger
from testtools.matchers import Equals
from zope.component import getUtility
from zope.security.interfaces import Unauthorized
@@ -39,6 +40,10 @@
layer = DatabaseFunctionalLayer
+ def setUp(self):
+ super(TestFeatureControlPage, self).setUp()
+ self.useFixture(FakeLogger())
+
def getUserBrowserAsTeamMember(self, teams):
"""Make a TestBrowser authenticated as a team member.
=== modified file 'lib/lp/services/webapp/tests/test_publication.py'
--- lib/lp/services/webapp/tests/test_publication.py 2016-01-26 15:14:01 +0000
+++ lib/lp/services/webapp/tests/test_publication.py 2017-05-11 14:53:15 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests publication.py"""
@@ -13,6 +13,7 @@
OAuthSignatureMethod_PLAINTEXT,
OAuthToken,
)
+from fixtures import FakeLogger
from storm.database import (
STATE_DISCONNECTED,
STATE_RECONNECT,
@@ -282,6 +283,7 @@
def test_not_found(self):
# No oopses are reported when accessing the referer while rendering
# the page.
+ self.useFixture(FakeLogger())
browser = self.getUserBrowser()
browser.addHeader('Referer', '/whut\xe7foo')
self.assertRaises(
@@ -298,6 +300,7 @@
def test_non_ascii_url(self):
# No oopses are reported when accessing the URL while rendering the
# page.
+ self.useFixture(FakeLogger())
browser = self.getUserBrowser()
self.assertRaises(
NotFound,
=== modified file 'lib/lp/translations/browser/tests/test_distribution_views.py'
--- lib/lp/translations/browser/tests/test_distribution_views.py 2012-01-01 02:58:52 +0000
+++ lib/lp/translations/browser/tests/test_distribution_views.py 2017-05-11 14:53:15 +0000
@@ -1,10 +1,11 @@
-# Copyright 2011 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the translations views on a distroseries."""
__metaclass__ = type
+from fixtures import FakeLogger
from zope.security.interfaces import Unauthorized
from lp.services.webapp import canonical_url
@@ -38,6 +39,7 @@
def test_unprivileged_users(self):
# Unprivileged users cannot access distribution translation settings
# page Distribution:+configure-translations.
+ self.useFixture(FakeLogger())
unprivileged = self.factory.makePerson()
distribution = self.factory.makeDistribution()
browser = self.getUserBrowser(user=unprivileged)
=== modified file 'lib/lp/translations/scripts/tests/test_remove_translations.py'
--- lib/lp/translations/scripts/tests/test_remove_translations.py 2014-12-08 23:42:47 +0000
+++ lib/lp/translations/scripts/tests/test_remove_translations.py 2017-05-11 14:53:15 +0000
@@ -1,6 +1,6 @@
#! /usr/bin/python
#
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test `remove_translations` and the `RemoveTranslations` script."""
@@ -21,6 +21,7 @@
from zope.testing.loghandler import Handler
from lp.registry.interfaces.person import IPersonSet
+from lp.services.log.logger import DevNullLogger
from lp.services.scripts.base import LaunchpadScriptFailure
from lp.testing import (
TestCase,
@@ -46,7 +47,8 @@
"""Create a `RemoveTranslations` script with given options."""
if isinstance(args, basestring):
args = [args]
- script = RemoveTranslations('remove-translations-test', test_args=args)
+ script = RemoveTranslations(
+ 'remove-translations-test', test_args=args, logger=DevNullLogger())
return script
=== modified file 'lib/lp/translations/tests/test_autoapproval.py'
--- lib/lp/translations/tests/test_autoapproval.py 2013-06-20 05:50:00 +0000
+++ lib/lp/translations/tests/test_autoapproval.py 2017-05-11 14:53:15 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Unit tests for translation import queue auto-approval.
@@ -14,6 +14,7 @@
timedelta,
)
+from fixtures import FakeLogger
from pytz import UTC
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
@@ -308,6 +309,7 @@
def setUp(self):
super(TestTemplateGuess, self).setUp()
+ self.useFixture(FakeLogger())
self.templateset = POTemplateSet()
def _setUpProduct(self):
Follow ups