Skip to main content

A simple check runner for Python

Project description

A very simple check runner for Python. I use this in projects where I need to run a suite of checks before performing some action (usually on invocation).

Usage

Create a sub-class of CheckRunner and declare your checks:

from checkrunner import CheckRunner

class MyChecks(CheckRunner):
    @classmethod
    def check_that_passes(cls):
        return True, 'this check passed!'

    @classmethod
    def check_that_fails(cls):
        return False, 'this check failed!'

print(MyChecks.run())
# (False, ['this check failed!'])

print(MyChecks.run(return_passed=True))
# (False, ['this check passed!', 'this check failed!'])

When all checks pass it will return True with an empty list (unless you set return_passed):

from checkrunner import CheckRunner

class MyChecks(CheckRunner):
    @classmethod
    def check_that_passes(cls):
        return True, 'this check passed!'

print(MyChecks.run())
# (True, [])

And that’s it!

Testing

tox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

checkrunner-0.0.1.tar.gz (4.9 kB view hashes)

Uploaded Source

checkrunner-0.0.1.macosx-10.12-x86_64.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

checkrunner-0.0.1-py2-none-any.whl (3.1 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page