Merge lp:~adeuring/launchpad/bug-594247-unittests-for-searchtasks-3 into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Gavin Panella on 2010-10-28 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 11843 |
| Proposed branch: | lp:~adeuring/launchpad/bug-594247-unittests-for-searchtasks-3 |
| Merge into: | lp:launchpad |
| Diff against target: |
310 lines (+230/-8) 2 files modified
lib/lp/bugs/tests/test_bugtask_search.py (+218/-3) lib/lp/testing/factory.py (+12/-5) |
| To merge this branch: | bzr merge lp:~adeuring/launchpad/bug-594247-unittests-for-searchtasks-3 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Gavin Panella (community) | 2010-10-28 | Approve on 2010-10-28 | |
|
Review via email:
|
|||
Commit Message
unit tests for BugTaskSet.
Description of the Change
This branch adds more unit tests for BugTaskSet.
I modified the testing factory method makeBug(): It is now possible to pass a distribution as the bug target. Without this change, tests of bug tasks for bugs without an upstream bugtask would have been somehwat pointless: Without this change, any bug created via makeBug() or makeBugTask() has at least one bugtask targeted to a product. In other words, a search for bugtasks without a related upstream task would never return anything.
test: ./bin/test -vvt lp.bugs.
no lint
| Abel Deuring (adeuring) wrote : | # |
Hi Gavin,
thanks for the review!
On 28.10.2010 15:27, Gavin Panella wrote:
> Review: Approve
> Cool. Only one very trivial comment.
>
>
> [1]
>
> + assert(
>
> This works, but it's misleading because assert is a statement not a
> function. Actually... did you mean to remove it before landing? If
> not, perhaps it should be changed to an assertEqual() call.
yeah, sure this is just a relic from debugging. I was a bit puzzled to
see it in the diff -- I could not find it in my local version. Turns out
that I forgot to "bzr commit" my latest changes...
| Gavin Panella (allenap) wrote : | # |
Hi Abel, I decided to start from scratch!
[1]
+from lp.registry.
+from lp.registry.
These are out of order. Consider using utilities/
it's more convenient brother format-
[2]
+ search_result = self.runSearch(
+ expected = self.resultValu
+ self.assertEqua
It's not worth changing it here, but a custom assertion method might
have saved a few keystrokes:
def assertSearchFin
expected = self.resultValu
[3]
+ raise AssertionError(
+ 'No bug task found for a product that is not the target of '
+ 'the main test bugtask.')
Either raise self.failureExc

Cool. Only one very trivial comment.
[1]
+ assert( bug.default_ bugtask. target == bugtarget)
This works, but it's misleading because assert is a statement not a
function. Actually... did you mean to remove it before landing? If
not, perhaps it should be changed to an assertEqual() call.