launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #16874
[Merge] lp:~cjwatson/launchpad/bugs-pyflakes into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/bugs-pyflakes into lp:launchpad.
Commit message:
Fix various pyflakes/lint errors in bugs, including removing an entire duplicate test class.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/bugs-pyflakes/+merge/222604
Fix various pyflakes/lint errors in bugs, including removing an entire duplicate test class.
--
https://code.launchpad.net/~cjwatson/launchpad/bugs-pyflakes/+merge/222604
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/bugs-pyflakes into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugalsoaffects.py'
--- lib/lp/bugs/browser/bugalsoaffects.py 2013-04-10 08:09:05 +0000
+++ lib/lp/bugs/browser/bugalsoaffects.py 2014-06-10 09:09:59 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -9,7 +9,6 @@
'BugAlsoAffectsProductWithProductCreationView'
]
-import cgi
from textwrap import dedent
from lazr.enum import (
=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py 2014-04-01 03:40:09 +0000
+++ lib/lp/bugs/browser/bugtarget.py 2014-06-10 09:09:59 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""IBugTarget-related browser views."""
@@ -26,7 +26,6 @@
import httplib
from operator import itemgetter
import urllib
-from urlparse import urljoin
from lazr.restful.interface import copy_field
from lazr.restful.interfaces import IJSONRequestCache
=== modified file 'lib/lp/bugs/browser/tests/test_bugtracker_component.py'
--- lib/lp/bugs/browser/tests/test_bugtracker_component.py 2012-04-16 23:02:44 +0000
+++ lib/lp/bugs/browser/tests/test_bugtracker_component.py 2014-06-10 09:09:59 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version (see the file LICENSE).
"""Unit tests for linking bug tracker components to source packages."""
@@ -68,8 +68,7 @@
form = self._makeForm(dsp)
self.assertIs(None, component.distro_source_package)
- view = create_initialized_view(
- component, name='+edit', form=form)
+ create_initialized_view(component, name='+edit', form=form)
self.assertEqual(dsp, component.distro_source_package)
def test_linking_notifications(self):
=== modified file 'lib/lp/bugs/interfaces/webservice.py'
--- lib/lp/bugs/interfaces/webservice.py 2013-01-03 00:27:37 +0000
+++ lib/lp/bugs/interfaces/webservice.py 2014-06-10 09:09:59 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""All the interfaces that are exposed through the webservice.
@@ -18,6 +18,7 @@
'IBugLinkTarget',
'IBugNomination',
'IBugSubscription',
+ 'IBugSubscriptionFilter',
'IBugTarget',
'IBugTask',
'IBugTracker',
=== modified file 'lib/lp/bugs/mail/tests/test_bug_subscribe.py'
--- lib/lp/bugs/mail/tests/test_bug_subscribe.py 2012-01-01 02:58:52 +0000
+++ lib/lp/bugs/mail/tests/test_bug_subscribe.py 2014-06-10 09:09:59 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for Bug subscription-related email tests."""
@@ -28,7 +28,7 @@
person_subscribed = self.factory.makePerson(
name='foosubed', displayname='Foo Subed')
self.assertEqual(len(stub.test_emails), 0)
- bug_subscription = bug.subscribe(
+ bug.subscribe(
person_subscribed, person_subscribing, suppress_notify=False)
transaction.commit()
self.assertEqual(len(stub.test_emails), 1)
@@ -44,7 +44,7 @@
person_subscribed = self.factory.makePerson(
name='foosubed', displayname='Foo Subed')
self.assertEqual(len(stub.test_emails), 0)
- bug_subscription = bug.subscribe(
+ bug.subscribe(
person_subscribed, person_subscribing, suppress_notify=True)
transaction.commit()
self.assertEqual(len(stub.test_emails), 0)
@@ -57,7 +57,6 @@
person_subscribed = self.factory.makePerson(
name='foosubed', displayname='Foo Subed')
self.assertEqual(len(stub.test_emails), 0)
- bug_subscription = bug.subscribe(
- person_subscribed, person_subscribing)
+ bug.subscribe(person_subscribed, person_subscribing)
transaction.commit()
self.assertEqual(len(stub.test_emails), 0)
=== modified file 'lib/lp/bugs/model/tests/test_bugtask.py'
--- lib/lp/bugs/model/tests/test_bugtask.py 2013-11-30 00:03:25 +0000
+++ lib/lp/bugs/model/tests/test_bugtask.py 2014-06-10 09:09:59 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -676,7 +676,7 @@
information_type=InformationType.PROPRIETARY)
with person_logged_in(spec.product.owner):
spec.linkBug(bug)
- return spec, bug
+ return spec, bug
def test_bug_specifications_is_filtered_for_anonymous(self):
spec, bug = self._createBugAndSpecification()
@@ -1650,98 +1650,6 @@
self.assertEqual(expected, self.get_counts(None))
-class TestStatusCountsForProductSeries(TestCaseWithFactory):
- """Test BugTaskSet.getStatusCountsForProductSeries()."""
-
- layer = DatabaseFunctionalLayer
-
- def setUp(self):
- super(TestStatusCountsForProductSeries, self).setUp()
- self.bugtask_set = getUtility(IBugTaskSet)
- self.owner = self.factory.makePerson()
- login_person(self.owner)
- self.product = self.factory.makeProduct(owner=self.owner)
- self.series = self.factory.makeProductSeries(product=self.product)
- self.milestone = self.factory.makeMilestone(productseries=self.series)
-
- def get_counts(self, user):
- return self.bugtask_set.getStatusCountsForProductSeries(
- user, self.series)
-
- def createBugs(self):
- self.factory.makeBug(milestone=self.milestone)
- self.factory.makeBug(
- milestone=self.milestone,
- information_type=InformationType.USERDATA)
- self.factory.makeBug(series=self.series)
- self.factory.makeBug(
- series=self.series, information_type=InformationType.USERDATA)
-
- def test_privacy_and_counts_for_unauthenticated_user(self):
- # An unauthenticated user should see bug counts for each status
- # that do not include private bugs.
- self.createBugs()
- self.assertEqual(
- {BugTaskStatus.NEW: 2},
- self.get_counts(None))
-
- def test_privacy_and_counts_for_owner(self):
- # The owner should see bug counts for each status that do
- # include all private bugs.
- self.createBugs()
- self.assertEqual(
- {BugTaskStatus.NEW: 4},
- self.get_counts(self.owner))
-
- def test_privacy_and_counts_for_other_user(self):
- # A random authenticated user should see bug counts for each
- # status that do include all private bugs, since it is costly to
- # query just the private bugs that the user has access to view,
- # and this query may be run many times on a single page.
- self.createBugs()
- other = self.factory.makePerson()
- self.assertEqual(
- {BugTaskStatus.NEW: 4},
- self.get_counts(other))
-
- def test_multiple_statuses(self):
- # Test that separate counts are provided for each status that
- # bugs are found in.
- statuses = [
- BugTaskStatus.INVALID,
- BugTaskStatus.OPINION,
- ]
- for status in statuses:
- self.factory.makeBug(milestone=self.milestone, status=status)
- self.factory.makeBug(series=self.series, status=status)
- for i in range(3):
- self.factory.makeBug(series=self.series)
- expected = {
- BugTaskStatus.INVALID: 2,
- BugTaskStatus.OPINION: 2,
- BugTaskStatus.NEW: 3,
- }
- self.assertEqual(expected, self.get_counts(None))
-
- def test_incomplete_status(self):
- # INCOMPLETE is stored as either INCOMPLETE_WITH_RESPONSE or
- # INCOMPLETE_WITHOUT_RESPONSE so the stats do not include a count of
- # INCOMPLETE tasks.
- statuses = [
- BugTaskStatusSearch.INCOMPLETE_WITH_RESPONSE,
- BugTaskStatusSearch.INCOMPLETE_WITHOUT_RESPONSE,
- BugTaskStatus.INCOMPLETE,
- ]
- for status in statuses:
- self.factory.makeBug(series=self.series, status=status)
- flush_database_updates()
- expected = {
- BugTaskStatusSearch.INCOMPLETE_WITH_RESPONSE: 1,
- BugTaskStatusSearch.INCOMPLETE_WITHOUT_RESPONSE: 2,
- }
- self.assertEqual(expected, self.get_counts(None))
-
-
class TestBugTaskMilestones(TestCaseWithFactory):
"""Tests that appropriate milestones are returned for bugtasks."""
=== modified file 'lib/lp/bugs/subscribers/tests/test_bug.py'
--- lib/lp/bugs/subscribers/tests/test_bug.py 2013-11-29 12:51:58 +0000
+++ lib/lp/bugs/subscribers/tests/test_bug.py 2014-06-10 09:09:59 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -55,16 +55,15 @@
def newSubscriber(self, bug, name, level):
# Create a new bug subscription with a new person.
subscriber = self.factory.makePerson(name=name)
- subscription = bug.subscribe(
- subscriber, subscriber, level=level)
+ bug.subscribe(subscriber, subscriber, level=level)
return subscriber
def getNotifiedPersons(self, include_all=False):
notified_persons = Store.of(self.bug).find(
Person,
- BugNotification.id==BugNotificationRecipient.bug_notificationID,
- BugNotificationRecipient.personID==Person.id,
- BugNotification.bugID==self.bug.id)
+ BugNotification.id == BugNotificationRecipient.bug_notificationID,
+ BugNotificationRecipient.personID == Person.id,
+ BugNotification.bugID == self.bug.id)
if include_all:
return list(notified_persons)
else:
=== modified file 'lib/lp/bugs/tests/test_bzremotecomponentfinder.py'
--- lib/lp/bugs/tests/test_bzremotecomponentfinder.py 2012-01-01 02:58:52 +0000
+++ lib/lp/bugs/tests/test_bzremotecomponentfinder.py 2014-06-10 09:09:59 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests cronscript for retriving components from remote Bugzillas"""
@@ -196,7 +196,7 @@
self.assertEqual(u'Driver/Radeon', comp.name)
def test_get_remote_products_and_components_encounters_301(self):
- lp_bugtracker = self.factory.makeBugTracker()
+ self.factory.makeBugTracker()
transaction.commit()
bz_scraper = FaultyBugzillaRemoteComponentScraper(
error=HTTPError("http://bugzilla.example.com",
@@ -207,7 +207,7 @@
self.assertGetRemoteProductsAndComponentsDoesNotAssert(finder)
def test_get_remote_products_and_components_encounters_400(self):
- lp_bugtracker = self.factory.makeBugTracker()
+ self.factory.makeBugTracker()
transaction.commit()
bz_scraper = FaultyBugzillaRemoteComponentScraper(
error=HTTPError("http://bugzilla.example.com",
@@ -218,7 +218,7 @@
self.assertGetRemoteProductsAndComponentsDoesNotAssert(finder)
def test_get_remote_products_and_components_encounters_404(self):
- lp_bugtracker = self.factory.makeBugTracker()
+ self.factory.makeBugTracker()
transaction.commit()
bz_scraper = FaultyBugzillaRemoteComponentScraper(
error=HTTPError("http://bugzilla.example.com",
@@ -229,7 +229,7 @@
self.assertGetRemoteProductsAndComponentsDoesNotAssert(finder)
def test_get_remote_products_and_components_encounters_500(self):
- lp_bugtracker = self.factory.makeBugTracker()
+ self.factory.makeBugTracker()
transaction.commit()
bz_scraper = FaultyBugzillaRemoteComponentScraper(
error=HTTPError("http://bugzilla.example.com",
Follow ups