From 35daf88dc9f1cc97ec1a5245dffd99c7ed5e610f Mon Sep 17 00:00:00 2001 From: voidZXL Date: Sun, 7 Apr 2024 01:11:17 +0800 Subject: [PATCH] fix tests --- tests/conftest.py | 5 ++++- tests/test_api/test_api_fastapi.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 5b9b1af..abaa7e4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -188,7 +188,10 @@ def make_server_thread(backend, port: int = None, **kwargs): def server_thread(service: UtilMeta): service.set_backend(backend) if port: - service.port = port + if service.asynchronous: + service.port = int(f'1{port}') + else: + service.port = port else: service.resolve_port() diff --git a/tests/test_api/test_api_fastapi.py b/tests/test_api/test_api_fastapi.py index 8b5ca77..19a66ab 100644 --- a/tests/test_api/test_api_fastapi.py +++ b/tests/test_api/test_api_fastapi.py @@ -11,7 +11,11 @@ def test_fastapi_api(service, fastapi_server_process): do_live_api_tests(service) + service._application = None + service.adaptor.app = None def test_fastapi_api_internal(service, fastapi_server_thread): do_live_api_tests(service) + service._application = None + service.adaptor.app = None