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(sanic/tests): replace usage of response.stream #3887

Merged
merged 1 commit into from Jun 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion tests/contrib/sanic/test_sanic.py
Expand Up @@ -9,7 +9,6 @@
from sanic.exceptions import InvalidUsage
from sanic.exceptions import ServerError
from sanic.response import json
from sanic.response import stream
from sanic.response import text
from sanic.server import HttpProtocol

Expand All @@ -28,6 +27,18 @@
sanic_version = tuple(map(int, sanic_version.split(".")))


try:
from sanic.response import ResponseStream

def stream(*args, **kwargs):
return ResponseStream(*args, **kwargs)


except ImportError:
# stream was removed in sanic v22.6.0
from sanic.response import stream


def _response_status(response):
return getattr(response, "status_code", getattr(response, "status", None))

Expand Down