Python unittest simplified.
Project description
choba
Wrapper to simplify calls to python unittest
,
coverage
and
webtest
.
Installation
$ pip install choba $ choba -h Usage: choba [-hl] [-s <submodule>] [-f <filter>] <dir>
Usage
$ export PYTHONPATH=`pwd`/src $ choba <your_test_directory>
The call will internally process ./.coveragerc
. HTML and
Cobertura-compatible XML code coverage report are automatically
generated.
sample configuration .coveragerc
:
[run] source = src omit = src/myproject/__init__.py src/myproject/daemon.py */__main__.py [html] directory = docs/coverage [xml] output = docs/coverage/coverage.xml [report] exclude_lines = if __name__ ==
In choba, branch coverage is always true regardless what you put in the configuration file.
sample module:
# ./src/myproject/common/utils.py import re def flatten(text): """ Remove line breaks and trim. """ text = re.sub(r'[\r\n\t]+', ' ', text) text = re.sub(r' +', ' ', text) return text.strip()
sample test:
# ./tests/common/utils.py import unittest # test against ./src/myproject/common/utils.py from myproject import utils class TestCommon(unittest.TestCase): def test_myfunc(self): text = "\raaa\nbbb\t\r\n" self.assertEquals("aaa bbb", utils.flatten(text))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size choba-1.0.2-py3-none-any.whl (6.1 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size choba-1.0.2.tar.gz (4.8 kB) | File type Source | Python version None | Upload date | Hashes View |