Skip to content

Commit

Permalink
fix(sanic/tests): replace usage of response.stream
Browse files Browse the repository at this point in the history
This function was removed in sanic [v22.6.0](sanic-org/sanic#2487).

We can just use ResponseStream directly.
  • Loading branch information
Kyle-Verhoog committed Jun 30, 2022
1 parent 94b0770 commit da875e8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 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,16 @@
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

0 comments on commit da875e8

Please sign in to comment.