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

fix: Add a DummyErrorHandler #137

Merged
merged 5 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/functions_framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,14 @@ def __call__(self, *args, **kwargs):


app = LazyWSGIApp()


class DummyErrorHandler:
def __init__(self):
pass

def __call__(self, *args, **kwargs):
return self


errorhandler = DummyErrorHandler()
4 changes: 2 additions & 2 deletions tests/test_cloudevent_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import pytest

from cloudevents.http import CloudEvent, from_http, to_binary, to_structured
from cloudevents.http import CloudEvent, to_binary, to_structured

from functions_framework import LazyWSGIApp, create_app, exceptions
from functions_framework import create_app

TEST_FUNCTIONS_DIR = pathlib.Path(__file__).resolve().parent / "test_functions"
TEST_DATA_DIR = pathlib.Path(__file__).resolve().parent / "test_data"
Expand Down
8 changes: 7 additions & 1 deletion tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import functions_framework

from functions_framework import LazyWSGIApp, create_app, exceptions
from functions_framework import LazyWSGIApp, create_app, errorhandler, exceptions

TEST_FUNCTIONS_DIR = pathlib.Path.cwd() / "tests" / "test_functions"

Expand Down Expand Up @@ -454,6 +454,12 @@ def test_lazy_wsgi_app(monkeypatch, target, source, signature_type):
]


def test_dummy_error_handler():
@errorhandler("foo", bar="baz")
def function():
pass


def test_class_in_main_is_in_right_module():
source = TEST_FUNCTIONS_DIR / "module_is_correct" / "main.py"
target = "function"
Expand Down