Merge lp:~benji/lpsetup/bug-1017973-add-smoke-tests into lp:lpsetup
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Benji York on 2012-06-26 | ||||
| Approved revision: | 39 | ||||
| Merged at revision: | 35 | ||||
| Proposed branch: | lp:~benji/lpsetup/bug-1017973-add-smoke-tests | ||||
| Merge into: | lp:lpsetup | ||||
| Diff against target: |
153 lines (+49/-24) 7 files modified
lpsetup/argparser.py (+1/-4) lpsetup/cli.py (+21/-10) lpsetup/tests/subcommands/test_inithost.py (+0/-2) lpsetup/tests/subcommands/test_install.py (+0/-2) lpsetup/tests/subcommands/test_smoke.py (+21/-0) lpsetup/tests/test_argparser.py (+3/-4) setup.py (+3/-2) |
||||
| To merge this branch: | bzr merge lp:~benji/lpsetup/bug-1017973-add-smoke-tests | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Francesco Banconi (community) | 2012-06-26 | Approve on 2012-06-26 | |
|
Review via email:
|
|||
Commit Message
add a basic smoke test for the subcommands
Description of the Change
This branch adds a basic smoke test for the subcommands by running each with --help and asserting that no exceptions are raised and a non-error (zero) exit code is returned.
A little refactoring was required to get the tests to work, which was discussed with Francesco by way of mid-implementation call.
Lint: pocketlint reports no lint
Tests: the obvious test was added and I also tested the test by introducing SyntaxError and NameError in subcommand code and verified that the new test failed.
| Benji York (benji) wrote : | # |
> Now the main function is consistent and just returns an error, an exit code or
> None, and that's great. However, in my opinion we should return the error or
> the exit code here too, otherwise lp-setup exits with 0 even if wrong
> arguments are provided. Something like::
>
> except SystemExit as err:
> return err # or err.code
Indeed! I have made that change (using err.code).
| Brad Crittenden (bac) wrote : | # |
There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.
| Brad Crittenden (bac) wrote : | # |
Attempt to merge into lp:lpsetup failed due to conflicts:
text conflict in lpsetup/
| Brad Crittenden (bac) wrote : | # |
The attempt to merge lp:~benji/lpsetup/bug-1017973-add-smoke-tests into lp:lpsetup failed. Below is the output from the failed tests.
nose.plugins.cover: ERROR: Coverage not available: unable to import coverage module
.......
nosetests: error: unrecognized arguments: --foo eggs
E......
=======
ERROR: test_failing_step (lpsetup.
-------
Traceback (most recent call last):
File "/var/cache/
self.
File "/var/cache/
namespace = self.parse(*args)
File "/var/cache/
namespace = self.parser.
File "/var/cache/
return super(ArgumentP
File "/usr/lib/
self.error(msg % ' '.join(argv))
File "/usr/lib/
self.exit(2, _('%s: error: %s\n') % (self.prog, message))
File "/usr/lib/
_sys.
SystemExit: 2
-------
Ran 75 tests in 0.636s
FAILED (errors=1)
| Brad Crittenden (bac) wrote : | # |
There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Benji, the code looks good, and thanks for your changes to the previous weird exception handling in *StepsBasedSubc ommand. handle* .
Just an observation:
54 + try: parse_args( args)
55 + args = parser.
56 + except SystemExit:
57 + return 0
Now the main function is consistent and just returns an error, an exit code or None, and that's great. However, in my opinion we should return the error or the exit code here too, otherwise lp-setup exits with 0 even if wrong arguments are provided. Something like::
except SystemExit as err:
return err # or err.code