launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06572
lp:~salgado/launchpad/workitem-migration-allow-inactive-milestones into lp:launchpad
Guilherme Salgado has proposed merging lp:~salgado/launchpad/workitem-migration-allow-inactive-milestones into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~salgado/launchpad/workitem-migration-allow-inactive-milestones/+merge/95624
Make sure work items targeted to inactive milestones are migrated.
--
https://code.launchpad.net/~salgado/launchpad/workitem-migration-allow-inactive-milestones/+merge/95624
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~salgado/launchpad/workitem-migration-allow-inactive-milestones into lp:launchpad.
=== modified file 'lib/lp/blueprints/tests/test_workitem_migration.py'
--- lib/lp/blueprints/tests/test_workitem_migration.py 2012-02-29 15:22:38 +0000
+++ lib/lp/blueprints/tests/test_workitem_migration.py 2012-03-02 17:18:21 +0000
@@ -196,6 +196,20 @@
assignee=None, title="A single work item", milestone=milestone,
status=SpecificationWorkItemStatus.TODO, specification=spec))
+ def test_work_item_with_inactive_milestone(self):
+ milestone = self.factory.makeMilestone(active=False)
+ whiteboard = dedent("""
+ Work items for %s:
+ A single work item: TODO
+ """ % milestone.name)
+ spec = self.factory.makeSpecification(
+ whiteboard=whiteboard, product=milestone.product)
+ work_items = extractWorkItemsFromWhiteboard(spec)
+ self.assertEqual(1, len(work_items))
+ self.assertThat(work_items[0], MatchesStructure.byEquality(
+ assignee=None, title="A single work item", milestone=milestone,
+ status=SpecificationWorkItemStatus.TODO, specification=spec))
+
def test_work_item_with_unknown_milestone(self):
whiteboard = dedent("""
Work items for foo:
=== modified file 'lib/lp/blueprints/workitemmigration.py'
--- lib/lp/blueprints/workitemmigration.py 2012-02-29 15:04:36 +0000
+++ lib/lp/blueprints/workitemmigration.py 2012-03-02 17:18:21 +0000
@@ -81,7 +81,9 @@
for word in words:
if word == milestone.name:
return milestone
- raise WorkItemParseError("No valid milestones found in %s" % words)
+ raise WorkItemParseError(
+ "No valid milestones found in %s. Valid milestone names are %s"
+ % (words, [m.name for m in valid_milestones]))
def extractWorkItemsFromWhiteboard(spec):
@@ -94,7 +96,7 @@
in_wi_block = False
new_whiteboard = []
- target_milestones = list(spec.target.milestones)
+ target_milestones = list(spec.target.all_milestones)
wi_lines = []
# Iterate over all lines in the whiteboard and whenever we find a line
# matching work_items_re we 'continue' and store the following lines
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2012-02-29 13:27:51 +0000
+++ lib/lp/testing/factory.py 2012-03-02 17:18:21 +0000
@@ -848,7 +848,7 @@
return getUtility(ITranslatorSet).new(group, language, person)
def makeMilestone(self, product=None, distribution=None,
- productseries=None, name=None):
+ productseries=None, name=None, active=True):
if product is None and distribution is None and productseries is None:
product = self.makeProduct()
if distribution is None:
@@ -864,7 +864,7 @@
return ProxyFactory(
Milestone(product=product, distribution=distribution,
productseries=productseries, distroseries=distroseries,
- name=name))
+ name=name, active=active))
def makeProcessor(self, family=None, name=None, title=None,
description=None):