Skip to content

Commit 363fd0e

Browse files
committed
fix tests for sanic [async] and django 3
1 parent 1672f2d commit 363fd0e

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

tests/test_3_api/test_api_django.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ def test_django_api(service, django_server_process):
2020
if django.VERSION < (3, 1) and service.asynchronous:
2121
return
2222
do_live_api_tests(service)
23-
do_live_api_sse_tests(
24-
port=18001 if service.asynchronous else 8001,
25-
asynchronous=False,
26-
with_timeout=not service.asynchronous
27-
)
28-
do_live_api_sse_tests(
29-
port=18001 if service.asynchronous else 8001,
30-
asynchronous=True,
31-
with_timeout=service.asynchronous
32-
)
23+
if django.VERSION >= (4, 0):
24+
do_live_api_sse_tests(
25+
port=18001 if service.asynchronous else 8001,
26+
asynchronous=False,
27+
with_timeout=not service.asynchronous
28+
)
29+
do_live_api_sse_tests(
30+
port=18001 if service.asynchronous else 8001,
31+
asynchronous=True,
32+
with_timeout=service.asynchronous
33+
)
3334
service._application = None
3435
service.adaptor.app = None
3536

tests/test_3_api/test_api_sanic.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ def test_sanic_api(service, sanic_server_process):
1414
do_live_api_tests(service)
1515

1616
if service.asynchronous:
17-
do_live_api_sse_tests(port=18004 if service.asynchronous else 8004, asynchronous=False)
18-
do_live_api_sse_tests(port=18004 if service.asynchronous else 8004, asynchronous=True)
17+
do_live_api_sse_tests(
18+
port=18004 if service.asynchronous else 8004, asynchronous=False,
19+
with_timeout=not service.asynchronous
20+
# wired error since win32 platform can run it successfully
21+
)
22+
do_live_api_sse_tests(
23+
port=18004 if service.asynchronous else 8004, asynchronous=True,
24+
with_timeout=not service.asynchronous
25+
)
1926
# sanic error: sanic.exceptions.ServerError: Attempted response to unknown request
2027
# but not interfere the result
2128

0 commit comments

Comments
 (0)