launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28065
[Merge] ~ilasc/launchpad:add-dne-bug-task-status into launchpad:master
Ioana Lasc has proposed merging ~ilasc/launchpad:add-dne-bug-task-status into launchpad:master.
Commit message:
Add DOES_NOT_EXIST status to BugTaskStatus
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~ilasc/launchpad/+git/launchpad/+merge/415250
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/launchpad:add-dne-bug-task-status into launchpad:master.
diff --git a/lib/lp/bugs/browser/tests/test_bugtask.py b/lib/lp/bugs/browser/tests/test_bugtask.py
index 245ba07..5e47e83 100644
--- a/lib/lp/bugs/browser/tests/test_bugtask.py
+++ b/lib/lp/bugs/browser/tests/test_bugtask.py
@@ -1228,7 +1228,8 @@ class TestBugTaskEditViewStatusField(TestCaseWithFactory):
view.initialize()
self.assertEqual(
['New', 'Incomplete', 'Opinion', 'Invalid', 'Confirmed',
- 'In Progress', 'Fix Committed', 'Fix Released'],
+ 'In Progress', 'Fix Committed', 'Fix Released',
+ 'Does not exist'],
self.getWidgetOptionTitles(view.form_fields['status']))
def test_status_field_privileged_persons(self):
@@ -1244,7 +1245,7 @@ class TestBugTaskEditViewStatusField(TestCaseWithFactory):
self.assertEqual(
['New', 'Incomplete', 'Opinion', 'Invalid', "Won't Fix",
'Confirmed', 'Triaged', 'In Progress', 'Fix Committed',
- 'Fix Released'],
+ 'Fix Released', 'Does not exist'],
self.getWidgetOptionTitles(view.form_fields['status']),
'Unexpected set of settable status options for %s'
% user.name)
@@ -1262,7 +1263,8 @@ class TestBugTaskEditViewStatusField(TestCaseWithFactory):
view.initialize()
self.assertEqual(
['New', 'Incomplete', 'Opinion', 'Invalid', 'Confirmed',
- 'In Progress', 'Fix Committed', 'Fix Released', 'Unknown'],
+ 'In Progress', 'Fix Committed', 'Fix Released', 'Does not exist',
+ 'Unknown'],
self.getWidgetOptionTitles(view.form_fields['status']))
def test_status_field_bug_task_in_status_expired(self):
@@ -1276,7 +1278,8 @@ class TestBugTaskEditViewStatusField(TestCaseWithFactory):
view.initialize()
self.assertEqual(
['New', 'Incomplete', 'Opinion', 'Invalid', 'Expired',
- 'Confirmed', 'In Progress', 'Fix Committed', 'Fix Released'],
+ 'Confirmed', 'In Progress', 'Fix Committed', 'Fix Released',
+ 'Does not exist'],
self.getWidgetOptionTitles(view.form_fields['status']))
diff --git a/lib/lp/bugs/interfaces/bugtask.py b/lib/lp/bugs/interfaces/bugtask.py
index 5d22a40..027612d 100644
--- a/lib/lp/bugs/interfaces/bugtask.py
+++ b/lib/lp/bugs/interfaces/bugtask.py
@@ -224,6 +224,12 @@ class BugTaskStatus(DBEnumeratedType):
The fix was released.
""")
+ DOES_NOT_EXIST = DBItem(35, """
+ Does not exist
+
+ The package does not exist in this series.
+ """)
+
UNKNOWN = DBItem(999, """
Unknown
diff --git a/lib/lp/bugs/interfaces/tests/test_bugtask.py b/lib/lp/bugs/interfaces/tests/test_bugtask.py
index f940c15..d79f845 100644
--- a/lib/lp/bugs/interfaces/tests/test_bugtask.py
+++ b/lib/lp/bugs/interfaces/tests/test_bugtask.py
@@ -43,6 +43,7 @@ class TestFunctions(TestCase):
BugTaskStatus.EXPIRED: BugTaskStatus.EXPIRED,
BugTaskStatus.FIXCOMMITTED: BugTaskStatus.FIXCOMMITTED,
BugTaskStatus.FIXRELEASED: BugTaskStatus.FIXRELEASED,
+ BugTaskStatus.DOES_NOT_EXIST: BugTaskStatus.DOES_NOT_EXIST,
BugTaskStatus.INCOMPLETE: BugTaskStatus.INCOMPLETE,
BugTaskStatus.INPROGRESS: BugTaskStatus.INPROGRESS,
BugTaskStatus.INVALID: BugTaskStatus.INVALID,
@@ -63,6 +64,7 @@ class TestFunctions(TestCase):
BugTaskStatusSearch.EXPIRED: BugTaskStatus.EXPIRED,
BugTaskStatusSearch.FIXCOMMITTED: BugTaskStatus.FIXCOMMITTED,
BugTaskStatusSearch.FIXRELEASED: BugTaskStatus.FIXRELEASED,
+ BugTaskStatusSearch.DOES_NOT_EXIST: BugTaskStatus.DOES_NOT_EXIST,
BugTaskStatusSearch.INCOMPLETE: BugTaskStatus.INCOMPLETE,
BugTaskStatusSearch.INCOMPLETE_WITH_RESPONSE:
BugTaskStatusSearch.INCOMPLETE_WITH_RESPONSE,
@@ -88,6 +90,8 @@ class TestFunctions(TestCase):
BugTaskStatus.FIXCOMMITTED,
BugTaskStatusSearchDisplay.FIXRELEASED:
BugTaskStatus.FIXRELEASED,
+ BugTaskStatusSearchDisplay.DOES_NOT_EXIST:
+ BugTaskStatus.DOES_NOT_EXIST,
BugTaskStatusSearchDisplay.INCOMPLETE_WITH_RESPONSE:
BugTaskStatusSearch.INCOMPLETE_WITH_RESPONSE,
BugTaskStatusSearchDisplay.INCOMPLETE_WITHOUT_RESPONSE:
diff --git a/lib/lp/bugs/model/bugtask.py b/lib/lp/bugs/model/bugtask.py
index 7b31d6d..b468c5e 100644
--- a/lib/lp/bugs/model/bugtask.py
+++ b/lib/lp/bugs/model/bugtask.py
@@ -358,8 +358,8 @@ def validate_target(bug, target, retarget_existing=True,
try:
target.distribution.guessPublishedSourcePackageName(
target.sourcepackagename.name)
- except NotFoundError as e:
- raise IllegalTarget(e.args[0])
+ except NotFoundError:
+ return BugTaskStatus.DOES_NOT_EXIST
legal_types = target.pillar.getAllowedBugInformationTypes()
new_pillar = target.pillar not in bug.affected_pillars
@@ -416,9 +416,10 @@ def validate_new_target(bug, target, check_source_package=True):
"specified. You should fill in a package name for "
"the existing bug." % target.distribution.displayname)
- validate_target(
+ status = validate_target(
bug, target, retarget_existing=False,
check_source_package=check_source_package)
+ return status
@implementer(IBugTask)
@@ -1622,7 +1623,9 @@ class BugTaskSet:
pillars = set()
for target in targets:
if validate_target:
- validate_new_target(bug, target)
+ does_not_exist = validate_new_target(bug, target)
+ if does_not_exist:
+ status = does_not_exist
pillars.add(target.pillar)
target_keys.append(bug_target_to_key(target))
diff --git a/lib/lp/bugs/model/tests/test_bugtask.py b/lib/lp/bugs/model/tests/test_bugtask.py
index 4089d86..636910b 100644
--- a/lib/lp/bugs/model/tests/test_bugtask.py
+++ b/lib/lp/bugs/model/tests/test_bugtask.py
@@ -340,6 +340,30 @@ class TestBugTaskCreationPackageComponent(TestCaseWithFactory):
self.assertEqual(distro_series_sp_task.getPackageComponent().name,
'main')
+ def test_does_not_exist(self):
+ """DNE is assigned to a task when we've considered a possible bug
+ target and determined that the package didn't exist in that series.
+ """
+ bugtaskset = getUtility(IBugTaskSet)
+ mark = getUtility(IPersonSet).getByEmail('mark@xxxxxxxxxxx')
+ sourcepackage = self.factory.makeSourcePackage()
+ series = sourcepackage.distroseries
+ bug = self.factory.makeBug(target=series.distribution)
+ distro_series_task = bugtaskset.createTask(
+ bug, mark, series, importance=BugTaskImportance.MEDIUM)
+
+ self.assertEqual(distro_series_task.status, BugTaskStatus.NEW)
+
+ mint = self.factory.makeDistribution(name='mint')
+ self.factory.makeDistroSeries(
+ distribution=mint, version='1.0', name='dev')
+ dsp = self.factory.makeDistributionSourcePackage('choc', mint)
+
+ distro_series_task = bugtaskset.createTask(
+ bug, mark, dsp, importance=BugTaskImportance.MEDIUM)
+ self.assertEqual(distro_series_task.status,
+ BugTaskStatus.DOES_NOT_EXIST)
+
class TestBugTaskTargets(TestCase):
"""Verify we handle various bugtask targets correctly"""
Follow ups