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

IOpipe should gracefully handle mock context failures / add context checker #277

Closed
fastfiveoh opened this issue Nov 14, 2018 · 0 comments
Closed

Comments

@fastfiveoh
Copy link

fastfiveoh commented Nov 14, 2018

Description

When running unit tests, with IOpipe integrated, the unit tests fail in a non-graceful fashion if the context object is not right. IOpipe should not fail in these mock unit tests, but instead should gracefully print a warning message.

IOpipe should not break unit tests as their code should not need to know about IOpipes context requirements

It should handle it similarly to how it handles no token exceptions:

#if env var IOPIPE_ENABLED is set to False skip reporting
if self.config["enabled"] is False:
logger.debug("IOpipe agent disabled, skipping reporting")
return func(event, context)

        # If a token is not present, skip reporting
        if not self.config["token"]:
            warnings.warn(
                "Your function is decorated with iopipe, but a valid token was not found. "
                "Set the IOPIPE_TOKEN environment variable with your IOpipe project token."
            )
            return func(event, context)
@fastfiveoh fastfiveoh changed the title IOpipe should gracefully handle mock context / add context checker IOpipe should gracefully handle mock context failures / add context checker Nov 14, 2018
kolanos added a commit to kolanos/iopipe-python that referenced this issue Nov 28, 2018
kolanos added a commit that referenced this issue Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant