Merge lp:~allenap/maas/test-bling into lp:maas/trunk
| Status: | Merged |
|---|---|
| Merged at revision: | 22 |
| Proposed branch: | lp:~allenap/maas/test-bling |
| Merge into: | lp:maas/trunk |
| Diff against target: |
1189 lines (+898/-55) 22 files modified
.ctags (+4/-0) Makefile (+2/-1) buildout.cfg (+3/-0) setup.py (+15/-10) src/maas/development.py (+8/-8) src/maas/settings.py (+3/-2) src/maas/testing/__init__.py (+37/-0) src/maas/testing/runner.py (+11/-4) src/maas/urls.py (+2/-1) src/maasserver/macaddress.py (+2/-2) src/maasserver/models.py (+1/-2) src/maasserver/tests/__init__.py (+8/-10) src/maasserver/tests/test_macaddressfield.py (+10/-5) src/maasserver/tests/test_models.py (+15/-6) src/maasserver/urls.py (+4/-1) src/maasserver/views.py (+4/-3) templates/README (+3/-0) templates/module.py (+9/-0) templates/test.py (+19/-0) utilities/format-imports (+406/-0) utilities/format-new-and-modified-imports (+13/-0) utilities/python_standard_libs.py (+319/-0) |
| To merge this branch: | bzr merge lp:~allenap/maas/test-bling |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Raphaël Badin (community) | 2012-01-18 | Needs Information on 2012-01-18 | |
|
Review via email:
|
|||
Description of the Change
This brings testresources and testtools into maas, creating a base class from these. It also adds some templates to use when creating a new module or test.
- 28. By Gavin Panella on 2012-01-18
-
Merge trunk, resolving 1 conflict.
- 29. By Gavin Panella on 2012-01-18
-
Use templates/test.py and maas.testing.
TestCase in test_macaddress field. - 30. By Gavin Panella on 2012-01-18
-
Fix lint.
| Gavin Panella (allenap) wrote : | # |
Thanks for the great review :)
> [1]
>
> 62 # Use our custom test runner, which makes sure that a local database
> 63 # cluster is running in the branch.
> 64 -TEST_RUNNER=
> 65 +TEST_RUNNER=
>
> Why the rename? It is indeed a custom runner isn't it?
Yes, but so is anything that's a subclass. I first changed it to
MaaSTestRunner then realised that it was already in the maas namespace
so dropped the prefix. Perhaps I should have just left it alone right
from the start :)
> [2]
>
> 339 +from maas.testing import TestCase
> 340 +
> 341 +
> 342 +class TestSomething(
>
> This is in the template, but you have not updated the existing
> tests. Why is that?
I think I have...?
> Also, I sense this is a problem because this will require
> maasserver's tests to import from maas.testing. This is not a no-go
> but maas is a simple app that should be independent of the
> containing project.
You have a good point. I thought about this a bit...
* Move preexisting stuff in maas to maas.web
* Move maasserver to maas.api
* Leaves room for maas.metadata, etc.
* maas.testing remains where it is, available for all.
(In other words, .api and .metadata are applications used by .web.)
> [3]
>
> Maybe we should add the copyright headers in a separate branch on
> all the files at once.
Ah, perhaps, but we can get there one bit at a time too :)
> [4]
>
> 222 -from django.test import TestCase
> 223 -
> 224 -from maasserver.models import MACAddress, Node
> 225 +from maas.testing import TestCase
> 226 from maasserver.
> 227 +from maasserver.models import (
> 228 + MACAddress,
> 229 + Node,
> 230 + )
>
> How about stealing the lp code to do that if the script is not huge?
> I really don't want to do that manually each time add an import.
I have been thinking about packaging that up for a while. I will steal
it for now, but we really ought to get it out there. Fwiw, it can be
run from the LP tree without fuss; it operates on the working
directory, not on the tree in which it resides.
- 31. By Gavin Panella on 2012-01-18
-
Borrow format-imports from Launchpad.
- 32. By Gavin Panella on 2012-01-18
-
Update python_
standard_ libs for 2.7. - 33. By Gavin Panella on 2012-01-18
-
Also run pep8.
- 34. By Gavin Panella on 2012-01-18
-
Fix lint.
- 35. By Gavin Panella on 2012-01-18
-
Merge trunk.
- 36. By Gavin Panella on 2012-01-19
-
Merge trunk, resolving several conflicts.
- 37. By Gavin Panella on 2012-01-19
-
Add empty __init__.py to maasserver.testing, and up-call in NodeTest.setUp().
- 38. By Gavin Panella on 2012-01-19
-
Options for tags/TAGS generation.


Looks good. I confess I'm no test expert so I'm happy if the testsuite runs when I launch /bin/test. But I'm not sure about [2].
[1]
62 # Use our custom test runner, which makes sure that a local database 'maas.testing. runner. CustomTestRunne r' 'maas.testing. runner. TestRunner'
63 # cluster is running in the branch.
64 -TEST_RUNNER=
65 +TEST_RUNNER=
Why the rename? It is indeed a custom runner isn't it?
[2]
339 +from maas.testing import TestCase TestCase) :
340 +
341 +
342 +class TestSomething(
This is in the template, but you have not updated the existing tests. Why is that?
Also, I sense this is a problem because this will require maasserver's tests to import from maas.testing. This is not a no-go but maas is a simple app that should be independent of the containing project.
What do you think?
[3]
Maybe we should add the copyright headers in a separate branch on all the files at once.
[4]
222 -from django.test import TestCase macaddress import validate_mac
223 -
224 -from maasserver.models import MACAddress, Node
225 +from maas.testing import TestCase
226 from maasserver.
227 +from maasserver.models import (
228 + MACAddress,
229 + Node,
230 + )
How about stealing the lp code to do that if the script is not huge? I really don't want to do that manually each time add an import.