Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checker decorator #25

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open

Add checker decorator #25

wants to merge 13 commits into from

Conversation

luiscoms
Copy link
Member

@luiscoms luiscoms commented Jun 10, 2020

TODO: Fix decorate method raising missing 1 required positional argument: 'self'

Introduce checker decorator in order to fix #21

Usage:

from healthcheck import checker

@checker(name='addition-works')
def addition_works():
    if 1 + 1 == 2:
        return True, 'addition works'
    else:
        return False, 'the universe is broken'

@checker
def throws_exception():
    raise Exception()

Decorate class methods

class Foo:
    def __init__(self):
        checker(self.bar)

    def bar(self):
        return True, 'It works!'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a decorator
1 participant