Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4061)

Issue 9121043: Add more unit tests to the charm backend.

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 12 months ago by teknico
Modified:
10 years, 12 months ago
Reviewers:
bcsaller, frankban, mp+162106, gary.poster
Visibility:
Public.

Description

Add more unit tests to the charm backend. More unit tests for backend properties, commands and methods. In order to do that, it mangles the charm code pretty heavily: - it adds module prefixes to all functions imported by backend.py in order to make them monkeypatchable in tests; - it renames all sub-backends to mixins, for clarity. Arguably, "backend.mixins lists all active mixins" is clearer than "backend.backends lists all active sub-backends, some of which are actual backends and some others are mixins"; - it simplifies the code in a number of places; - it removes unused or scarcely used code in backend.py, for simplicity; - it rephrases some docstrings in more specific terms, for readability; - it removes the overrideable testing framework in backend.py. It imposes a runtime and complexity cost for doing what is already done in other tests by monkeypatching; Further style changes have been moved to a subsequent branch. It also fixes two import errors. WARNING: this branch did successfully deploy a stable juju-gui release. Deploy tests did not run successfully though, and they seem to be broken in trunk too, right now. https://code.launchpad.net/~teknico/charms/precise/juju-gui/1171516-more-backend-tests/+merge/162106 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 34

Patch Set 2 : Add more unit tests to the charm backend. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+347 lines, -256 lines) Patch
M .bzrignore View 1 chunk +1 line, -0 lines 0 comments Download
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M hooks/backend.py View 1 5 chunks +96 lines, -166 lines 0 comments Download
M hooks/stop View 1 chunk +1 line, -6 lines 0 comments Download
M hooks/utils.py View 1 5 chunks +17 lines, -48 lines 0 comments Download
M tests/test_backends.py View 1 1 chunk +221 lines, -31 lines 0 comments Download
M tests/test_utils.py View 2 chunks +9 lines, -5 lines 0 comments Download

Messages

Total messages: 9
teknico
Please take a look.
10 years, 12 months ago (2013-05-02 14:57:29 UTC) #1
teknico
Some comments to help with review, enjoy. :-) https://codereview.appspot.com/9121043/diff/1/hooks/backend.py File hooks/backend.py (left): https://codereview.appspot.com/9121043/diff/1/hooks/backend.py#oldcode125 hooks/backend.py:125: gui_properties ...
10 years, 12 months ago (2013-05-02 15:02:29 UTC) #2
bcsaller
LGTM (without qa) The code is neatly cleaned up in a number of places. I'd ...
10 years, 12 months ago (2013-05-02 15:25:44 UTC) #3
teknico
bcsaller wrote: > Isn't there defaultdict in the Python std lib collections for this? Indeed ...
10 years, 12 months ago (2013-05-02 16:04:10 UTC) #4
frankban
LGTM, and thanks for all the tests :-) https://codereview.appspot.com/9121043/diff/1/hooks/backend.py File hooks/backend.py (left): https://codereview.appspot.com/9121043/diff/1/hooks/backend.py#oldcode228 hooks/backend.py:228: def ...
10 years, 12 months ago (2013-05-02 16:13:32 UTC) #5
bcsaller
https://codereview.appspot.com/9121043/diff/1/hooks/backend.py File hooks/backend.py (right): https://codereview.appspot.com/9121043/diff/1/hooks/backend.py#newcode205 hooks/backend.py:205: return any(self.config.get(key) != self.prev_config.get(key) On 2013/05/02 16:13:32, frankban wrote: ...
10 years, 12 months ago (2013-05-02 16:15:27 UTC) #6
teknico
Thanks for the reviews! https://codereview.appspot.com/9121043/diff/1/hooks/backend.py File hooks/backend.py (right): https://codereview.appspot.com/9121043/diff/1/hooks/backend.py#newcode149 hooks/backend.py:149: through composition On 2013/05/02 16:13:32, ...
10 years, 12 months ago (2013-05-02 16:43:35 UTC) #7
teknico
*** Submitted: Add more unit tests to the charm backend. More unit tests for backend ...
10 years, 12 months ago (2013-05-02 16:53:14 UTC) #8
gary.poster
10 years, 12 months ago (2013-05-02 17:20:50 UTC) #9
Nice branch, teknico.  Thank you for landing it.

Gary
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b