← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/no-makebugtask-private into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/no-makebugtask-private into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/no-makebugtask-private/+merge/108096

While working on the previous factory work with makeBranch(private=True), I noticed this pearl -- makeBugTask(private=True) which behaves *totally* different. There is only one callsite, so it can just create a USERDATA bug with the right task and the special code can die.
-- 
https://code.launchpad.net/~stevenk/launchpad/no-makebugtask-private/+merge/108096
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/no-makebugtask-private into lp:launchpad.
=== modified file 'lib/lp/soyuz/scripts/tests/test_queue.py'
--- lib/lp/soyuz/scripts/tests/test_queue.py	2012-02-10 10:50:03 +0000
+++ lib/lp/soyuz/scripts/tests/test_queue.py	2012-05-31 05:05:23 +0000
@@ -28,6 +28,7 @@
     BugTaskStatus,
     IBugTaskSet,
     )
+from lp.registry.enums import InformationType
 from lp.registry.interfaces.distribution import IDistributionSet
 from lp.registry.interfaces.person import IPersonSet
 from lp.registry.interfaces.pocket import PackagePublishingPocket
@@ -1084,9 +1085,9 @@
         # we're testing.
         spr = self.factory.makeSourcePackageRelease(changelog_entry="blah")
         archive_admin = self.factory.makePerson()
-        bug_task = self.factory.makeBugTask(
-            target=spr.sourcepackage, private=True)
-        bug = bug_task.bug
+        bug = self.factory.makeBug(
+            sourcepackagename=spr.sourcepackagename,
+            information_type=InformationType.USERDATA)
         changes = StringIO(changes_file_template % bug.id)
 
         with person_logged_in(archive_admin):
@@ -1097,7 +1098,8 @@
 
         # Verify it was closed.
         with celebrity_logged_in("admin"):
-            self.assertEqual(bug_task.status, BugTaskStatus.FIXRELEASED)
+            self.assertEqual(
+                bug.default_bugtask.status, BugTaskStatus.FIXRELEASED)
 
 
 class TestQueueToolInJail(TestQueueBase, TestCase):

=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py	2012-05-30 14:17:37 +0000
+++ lib/lp/testing/factory.py	2012-05-31 05:05:23 +0000
@@ -80,7 +80,6 @@
     CreateBugParams,
     IBugSet,
     )
-from lp.bugs.interfaces.bugtarget import ISeriesBugTarget
 from lp.bugs.interfaces.bugtask import BugTaskStatus
 from lp.bugs.interfaces.bugtracker import (
     BugTrackerType,
@@ -1725,8 +1724,7 @@
 
         return bug
 
-    def makeBugTask(self, bug=None, target=None, owner=None, publish=True,
-                    private=False):
+    def makeBugTask(self, bug=None, target=None, owner=None, publish=True):
         """Create and return a bug task.
 
         If the bug is already targeted to the given target, the existing
@@ -1740,8 +1738,6 @@
             one will be created.
         :param target: The `IBugTarget`, to which the bug will be
             targeted to.
-        :param private: If a bug is not specified, the privacy state to use
-            when creating the bug for the bug task..
         """
 
         # Find and return the existing target if one exists.
@@ -1792,33 +1788,9 @@
                     bug, prerequisite_target, publish=publish)
                 bug = prerequisite.bug
 
-        # Private (and soon all) bugs cannot affect multiple projects
-        # so we ensure that if a bug has not been specified and one is
-        # created, it is for the same pillar as that of the specified target.
-        result_bug_task = None
-        if bug is None and private:
-            product = distribution = sourcepackagename = None
-            pillar = target.pillar
-            if IProduct.providedBy(pillar):
-                product = pillar
-            elif IDistribution.providedBy(pillar):
-                distribution = pillar
-            if (IDistributionSourcePackage.providedBy(target)
-                or ISourcePackage.providedBy(target)):
-                    sourcepackagename = target.sourcepackagename
-            bug = self.makeBug(
-                private=private, product=product, distribution=distribution,
-                sourcepackagename=sourcepackagename)
-            if not ISeriesBugTarget.providedBy(target):
-                result_bug_task = bug.default_bugtask
-        # We keep the existing behaviour for public bugs because
-        # test_bugtask_search breaks spectacularly otherwise. Almost all other
-        # tests pass.
         if bug is None:
             bug = self.makeBug()
 
-        if result_bug_task is not None:
-            return result_bug_task
         if owner is None:
             owner = self.makePerson()
         return removeSecurityProxy(bug).addTask(owner, target)


Follow ups