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.
Source Distribution
choba-1.0.2.tar.gz
(4.8 kB
view details)
Built Distribution
choba-1.0.2-py3-none-any.whl
(6.1 kB
view details)
File details
Details for the file choba-1.0.2.tar.gz
.
File metadata
- Download URL: choba-1.0.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
69a74d385863be8ac07ddd7f26fe01b977280e5b29fc8fb7f4a39ffd5fbafb89
|
|
MD5 |
803295ac979cb214971fe4dfb9f5bde1
|
|
BLAKE2b-256 |
66e5f08802d797b19f07c65877938fbcc49e5771555974caa8378f8a1300c40e
|
File details
Details for the file choba-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: choba-1.0.2-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
25c340d16b2034bedbe212423f58b2bcdb4c607fbcf5055098e0f330cddfc9f5
|
|
MD5 |
55934bca5b5c9e5d81337c486360e61f
|
|
BLAKE2b-256 |
75d45dd77f9c6adf1b066deaa7a2a189469260fce3692801fe8efac5a08c66f7
|