Merge lp:~jtv/maas/test-before-landing-bitch into lp:maas/trunk

Proposed by Jeroen T. Vermeulen on 2012-06-05
Status: Merged
Approved by: Jeroen T. Vermeulen on 2012-06-05
Approved revision: 608
Merged at revision: 608
Proposed branch: lp:~jtv/maas/test-before-landing-bitch
Merge into: lp:maas/trunk
Diff against target: 33 lines (+3/-5)
2 files modified
src/maasserver/testing/factory.py (+1/-2)
src/maasserver/tests/test_nodegroup.py (+2/-3)
To merge this branch: bzr merge lp:~jtv/maas/test-before-landing-bitch
Reviewer Review Type Date Requested Status
Julian Edwards (community) 2012-06-05 Approve on 2012-06-05
Review via email: mp+108697@code.launchpad.net

Commit Message

Fix test breakage, lint, and mis-formatted imports.

Description of the Change

The NodeGroup branch broke our build. Not when you ran its tests in isolation, but definitely when you ran the whole test suite. The reason is that the NodeGroup test case was derived from maastesting.TestCase, which does not know about Django's database, rather than from maasserver.testing.TestCase.

There was also some lint, and the imports formatting tool had apparently not been run. Tsk, tsk.

Lessons to be learned:
 * Stop the proliferation of TestCase classes. If it must be a TestCase-derivative, give it an obvious name.
 * Always run “make check” on a branch before landing it.
 * A warning about this in the template for our python tests may help.
 * “make lint” and “./utilities/format-new-and-modified-imports” should be habits.

Jeroen

To post a comment you must log in.
review: Approve
Julian Edwards (julian-edwards) wrote :

 * Stop the proliferation of TestCase classes. If it must be a TestCase-derivative, give it an obvious name.

For the love of $DEITY, YES YES YES.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/testing/factory.py'
2--- src/maasserver/testing/factory.py 2012-06-05 02:35:55 +0000
3+++ src/maasserver/testing/factory.py 2012-06-05 08:15:52 +0000
4@@ -28,11 +28,10 @@
5 FileStorage,
6 MACAddress,
7 Node,
8+ NODE_TRANSITIONS,
9 NodeGroup,
10- NODE_TRANSITIONS,
11 SSHKey,
12 )
13-from maasserver.models.nodegroup import NodeGroup
14 from maasserver.testing import (
15 get_data,
16 reload_object,
17
18=== modified file 'src/maasserver/tests/test_nodegroup.py'
19--- src/maasserver/tests/test_nodegroup.py 2012-06-05 05:49:12 +0000
20+++ src/maasserver/tests/test_nodegroup.py 2012-06-05 08:15:52 +0000
21@@ -12,11 +12,10 @@
22 __metaclass__ = type
23 __all__ = []
24
25+from maasserver.testing.factory import factory
26+from maasserver.testing.testcase import TestCase
27 from testtools.matchers import MatchesStructure
28
29-from maasserver.testing.factory import factory
30-from maastesting.testcase import TestCase
31-
32
33 class TestNodeGroup(TestCase):
34