Merge lp:~lool/lava-dispatcher/add-unittest-for-config into lp:~qzhang/lava-dispatcher/remove-hardcode
Proposed by
Loïc Minier
Status: | Merged |
---|---|
Merged at revision: | 16 |
Proposed branch: | lp:~lool/lava-dispatcher/add-unittest-for-config |
Merge into: | lp:~qzhang/lava-dispatcher/remove-hardcode |
Diff against target: |
46 lines (+31/-0) 3 files modified
.testr.conf (+3/-0) lava/tests/__init__.py (+6/-0) lava/tests/test_config.py (+22/-0) |
To merge this branch: | bzr merge lp:~lool/lava-dispatcher/add-unittest-for-config |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Spring Zhang | Approve | ||
Review via email: mp+52084@code.launchpad.net |
Description of the change
I don't actually think we should test static config data, but this gives you a sample testing framework.
You don't need it to run the tests, but a helpful helper is "testr" in the testrepository package; run it with "testr init" and "testr run".
To run the tests manually, use:
python -m testtools.run lava.tests.
To post a comment you must log in.
Thanks for the unit test sample. I run it successfully.
1. After I run "sudo pip install testtools --upgrade", I still got error: lib/python2. 6/dist- packages/ subunit/ run.py" , line 26, in <module>
File "/usr/local/
from testtools.run import (
ImportError: cannot import name BUFFEROUTPUT
id: 0 tests: 0
But I do "sudo apt-get install python-testtools", it works, what's the difference between pip-install and apt-get?
2. And when I do "testr delete", I got error: exit(run_ argv(sys. argv, sys.stdin, sys.stdout, sys.stderr)) python2. 6/dist- packages/ testrepository/ commands/ __init_ _.py", line 194, in run_argv cmd_name) python2. 6/dist- packages/ testrepository/ commands/ __init_ _.py", line 48, in _find_command commands. delete'
Traceback (most recent call last):
File "/usr/bin/testr", line 26, in <module>
sys.
File "/usr/lib/
cmdclass = _find_command(
File "/usr/lib/
raise KeyError("Could not import command module %s" % modname)
KeyError: 'Could not import command module testrepository.