Merge lp:~benji/lpsetup/bug-1017973-add-smoke-tests into lp:lpsetup
Proposed by
Benji York
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Benji York | ||||
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) | Approve | ||
Review via email: mp+112141@code.launchpad.net |
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.
To post a comment you must log in.
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