Skip to content

Commit

Permalink
remove full-sync tests for FastAPI(Starlette)
Browse files Browse the repository at this point in the history
  • Loading branch information
voidZXL committed Apr 12, 2024
1 parent 22594bb commit efb2ecb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pytest
import psutil
from utilmeta import UtilMeta
from typing import Union
# from django import VERSION as DJANGO_VERSION
SERVICE_PATH = os.path.join(os.path.dirname(__file__), 'server')
PARAMETRIZE_CONFIG = False
Expand Down Expand Up @@ -37,7 +38,7 @@
# cleanup_on_sigterm()


def setup_service(name, backend: str = None, async_param: bool = True, orm: str = None):
def setup_service(name, backend: str = None, async_param: Union[list, bool] = True, orm: str = None):
"""
If a list of params is provided, each param will not across and will execute in order
for every ConfigParam, params inside are consider crossing, will enumerate every possible combination
Expand All @@ -55,7 +56,9 @@ def setup_service(name, backend: str = None, async_param: bool = True, orm: str
# config_list = [config]

async_params = None
if async_param:
if isinstance(async_param, list):
async_params = async_param
elif async_param:
async_params = [False, True]

# if not backends:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_api/test_api_fastapi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from tests.conftest import make_live_process, setup_service, make_live_thread
from .params import do_live_api_tests

setup_service(__name__, backend='fastapi')
setup_service(__name__, backend='fastapi', async_param=[True])
# FastAPI (starlette) can have bad response to a full-sync context, so we only test the asynchronous version
fastapi_server_process = make_live_process(backend='fastapi', port=8002)
fastapi_server_thread = make_live_thread(
backend='fastapi',
Expand Down

0 comments on commit efb2ecb

Please sign in to comment.