Skip to content

Commit

Permalink
Fix httpx testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopkins committed Jan 6, 2022
1 parent fb97f3b commit ce0fdbf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions tests/test_pipelining.py
Expand Up @@ -62,19 +62,15 @@ async def handler(request):

data = ["hello", "world"]

class Data(AsyncByteStream):
def __init__(self, data):
self.data = data

async def __aiter__(self):
for value in self.data:
yield value.encode("utf-8")

client = ReusableClient(app, port=1234)

async def stream(data):
for value in data:
yield value.encode("utf-8")

with client:
_, response1 = client.post("/", data=Data(data))
_, response2 = client.post("/", data=Data(data))
_, response1 = client.post("/", data=stream(data))
_, response2 = client.post("/", data=stream(data))

assert response1.status == response2.status == 200
assert response1.json["data"] == response2.json["data"] == data
Expand Down
2 changes: 1 addition & 1 deletion tests/test_server_loop.py
Expand Up @@ -4,8 +4,8 @@

import pytest

from sanic.server import loop
from sanic.compat import OS_IS_WINDOWS, UVLOOP_INSTALLED
from sanic.server import loop


@pytest.mark.skipif(
Expand Down

0 comments on commit ce0fdbf

Please sign in to comment.