Skip to main content

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))

Release files for choba 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for choba 1.0.2
File Size Uploaded
choba-1.0.2.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for choba 1.0.2
File Interpreter ABI Platform
choba-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / choba-1.0.2.tar.gz

Download URL choba-1.0.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
69a74d385863be8ac07ddd7f26fe01b977280e5b29fc8fb7f4a39ffd5fbafb89
BLAKE2b-256 checksum
How to use checksums
66e5f08802d797b19f07c65877938fbcc49e5771555974caa8378f8a1300c40e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / choba-1.0.2-py3-none-any.whl

Download URL choba-1.0.2-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25c340d16b2034bedbe212423f58b2bcdb4c607fbcf5055098e0f330cddfc9f5
BLAKE2b-256 checksum
How to use checksums
75d45dd77f9c6adf1b066deaa7a2a189469260fce3692801fe8efac5a08c66f7
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page