From eaabe805ff7a191517509a0e7e9edc53cfcadae2 Mon Sep 17 00:00:00 2001 From: C9luster <138663536+C9luster@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:28:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0SDK=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=80=BB=E8=BE=91=20(#615)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 更新SDK单元测试逻辑 * 更新单测脚本 * 删除串行运行装饰器 --------- Co-authored-by: yinjiaqi --- python/tests/parallel_ut_run.py | 85 ++----------------- python/tests/test_agent.py | 2 - python/tests/test_animal_recognize.py | 1 - .../tests/test_appbuilder_assistant_trace.py | 1 - .../tests/test_appbuilder_client_chatflow.py | 1 - ...ppbuilder_client_chatflow_event_handler.py | 1 - ...uilder_client_chatflow_event_handler_v2.py | 1 - python/tests/test_appbuilder_client_trace.py | 1 - .../tests/test_appbuilder_components_trace.py | 1 - ...st_appbuilder_core_components_retriever.py | 1 - .../tests/test_appbuilder_sentry_trace_off.py | 1 - .../tests/test_appbuilder_sentry_trace_on.py | 1 - .../test_appbuilder_trace_raise_error.py | 1 - python/tests/test_assistant_basic_import.py | 1 - .../tests/test_assistant_class_assistans.py | 1 - python/tests/test_assistant_class_files.py | 1 - python/tests/test_assistant_class_messages.py | 1 - python/tests/test_assistant_class_runs.py | 1 - python/tests/test_assistant_class_runs_v2.py | 6 +- python/tests/test_assistant_class_threads.py | 1 - python/tests/test_assistant_e2e_funccall.py | 1 - .../test_assistant_e2e_funccall_component.py | 1 - python/tests/test_assistant_e2e_run.py | 1 - .../tests/test_assistant_e2e_stream_cancel.py | 1 - ...test_assistant_e2e_stream_event_handler.py | 1 - ...t_assistant_e2e_stream_event_handler_v2.py | 1 - .../test_assistant_e2e_stream_funccall.py | 1 - python/tests/test_assistant_e2e_stream_run.py | 1 - python/tests/test_console_rag.py | 1 - python/tests/test_core_client.py | 1 - python/tests/test_dialog_summary.py | 1 - python/tests/test_doc_crop_enhance.py | 1 - python/tests/test_gbi_nl2sql.py | 1 - python/tests/test_gbi_select_table.py | 1 - python/tests/test_hallucination_detection.py | 1 - python/tests/test_knowledge_base.py | 1 - python/tests/test_matching.py | 1 - python/tests/test_mrc.py | 1 - python/tests/test_nl2pandas.py | 1 - python/tests/test_oral_query_generation.py | 1 - python/tests/test_qa_llm_excel2figure.py | 1 - python/tests/test_qa_pair_mining.py | 1 - python/tests/test_qrcode_ocr.py | 1 - python/tests/test_rerank.py | 1 - python/tests/test_similar_question.py | 1 - python/tests/test_style_rewrite.py | 1 - python/tests/test_style_writing.py | 1 - python/tests/test_table_ocr.py | 1 - python/tests/test_trace_skip_raise_error.py | 1 - python/tests/test_treemind.py | 1 - 50 files changed, 7 insertions(+), 133 deletions(-) diff --git a/python/tests/parallel_ut_run.py b/python/tests/parallel_ut_run.py index dec626016..c4f769f53 100644 --- a/python/tests/parallel_ut_run.py +++ b/python/tests/parallel_ut_run.py @@ -50,9 +50,6 @@ # 可以CPU并行的单测用例 CPU_PARALLEL_RUN_UNITTEST = [] -# CPU上仅能串行执行的单测用例 -CPU_SERIAL_RUN_UNITTEST = [] - # 分类未知,故在CPU上串行执行的单测用例 UNKNOWN_UNITTEST = [] @@ -69,7 +66,6 @@ def choose_test_case(file): """ skip_case_str = '@unittest.skip(' cpu_parallel_str = '@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_PARALLEL"' - cpu_serial_str = '@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL"' with open(file, 'r') as f: all_line = f.readlines() @@ -82,10 +78,6 @@ def choose_test_case(file): CPU_PARALLEL_RUN_UNITTEST.append(file.split("/")[-1]) return - if list(set([line.strip().find(cpu_serial_str) for line in all_line])) != [-1]: - CPU_SERIAL_RUN_UNITTEST.append(file.split("/")[-1]) - return - UNKNOWN_UNITTEST.append(file.split("/")[-1]) return @@ -112,17 +104,11 @@ def get_all_unittest_file(): for idx, case in enumerate(SKIP_UNITTEST): logger.info("--> {}. {}".format(idx+1, case)) - logger.info( - "\nCPU并行的单测用例:{}个".format(len(CPU_PARALLEL_RUN_UNITTEST))) + logger.info("\nCPU并行的单测用例:{}个".format(len(CPU_PARALLEL_RUN_UNITTEST))) for idx, case in enumerate(CPU_PARALLEL_RUN_UNITTEST): logger.info("--> {}. {}".format(idx+1, case)) - logger.info( - "\nCPU串行执行的单测用例:{}个".format(len(CPU_SERIAL_RUN_UNITTEST))) - for idx, case in enumerate(CPU_SERIAL_RUN_UNITTEST): - logger.info("--> {}. {}".format(idx+1, case)) - - logger.info("\n运行模式未知,串行执行的单测用例:{}个".format(len(UNKNOWN_UNITTEST))) + logger.info("\nCPU串行执行的单测用例:{}个".format(len(UNKNOWN_UNITTEST))) for idx, case in enumerate(UNKNOWN_UNITTEST): logger.info("--> {}. {}".format(idx+1, case)) @@ -278,31 +264,18 @@ def run_cpu_parallel_unittest(): return success_cases, failed_cases, end_time - begin_time - - -def run_cpu_serial_unittest(): - """ - 运行CPU_SERIAL模式下的单元测试,包括并行和串行两种方式,记录并打印成功和失败的情况及耗时 - - Args: - 无 - - Returns: - success_cases (list): 成功运行的测试用例列表 - failed_cases (list): 失败运行的测试用例列表 - total_time (float): 运行总耗时(单位:秒) - """ +def run_unknown_unittest(): os.environ["TEST_CASE"] = "CPU_SERIAL" logger.info("\n================ CPU_SERIAL ================\n") begin_time = time.time() success_cases, failed_cases, total_case_time = parallel_execute_unittest( - CPU_SERIAL_RUN_UNITTEST, 1) + UNKNOWN_UNITTEST, 1) logger.info("\n CPU_SERIAL 运行成功单测:{} 个".format(len(success_cases))) if len(failed_cases) > 0: - logger.info("\n以下单测失败,将重试运行 2 次") + logger.info("\n以下单测失败,将重试运行一次") for case in failed_cases: logger.info("retry case --> {}".format(case)) retry_success_cases, retry_failed_cases, retry_case_time = parallel_execute_unittest( @@ -313,16 +286,6 @@ def run_cpu_serial_unittest(): for success in retry_success_cases: failed_cases.remove(success) - if len(retry_failed_cases) > 0: - logger.info("\n以下单测失败,将重试运行 1 次") - for case in retry_failed_cases: - logger.info("retry case --> {}".format(case)) - second_success_cases, second_failed_cases, second_case_time = parallel_execute_unittest( - retry_failed_cases, 1) - total_case_time += second_case_time - for success in second_success_cases: - failed_cases.remove(success) - end_time = time.time() logger.info("\n CPU_SERIAL 运行失败单测: {} 个".format(len(failed_cases))) for failed in failed_cases: @@ -336,41 +299,6 @@ def run_cpu_serial_unittest(): return success_cases, failed_cases, end_time - begin_time -def run_unknown_unittest(): - os.environ["TEST_CASE"] = "UNKNOWN" - logger.info("\n================ UNKNOWN ================\n") - - begin_time = time.time() - success_cases, failed_cases, total_case_time = parallel_execute_unittest( - UNKNOWN_UNITTEST, 2) - - logger.info("\n UNKNOWN 运行成功单测:{} 个".format(len(success_cases))) - - if len(failed_cases) > 0: - logger.info("\n以下单测失败,将重试运行一次") - for case in failed_cases: - logger.info("retry case --> {}".format(case)) - retry_success_cases, retry_failed_cases, retry_case_time = parallel_execute_unittest( - failed_cases, 1) - - total_case_time += retry_case_time - - for success in retry_success_cases: - failed_cases.remove(success) - - end_time = time.time() - logger.info("\n UNKNOWN 运行失败单测: {} 个".format(len(failed_cases))) - for failed in failed_cases: - logger.info("--> {}".format(failed)) - - logger.info("\n UNKNOWN 单测并行运行总计耗时 {} s".format( - end_time - begin_time)) - logger.info("\n UNKNOWN 单测串行运行总计耗时 {} s".format( - total_case_time)) - - return success_cases, failed_cases, end_time - begin_time - - def create_unittest_report(): """ 生成单元测试报告。 @@ -391,8 +319,7 @@ def create_unittest_report(): total_failed_cases = [] total_ut_time = 0 - test_suite = [run_cpu_parallel_unittest, - run_cpu_serial_unittest, run_unknown_unittest] + test_suite = [run_cpu_parallel_unittest, run_unknown_unittest] for suite in test_suite: success_cases, failed_cases, suite_time = suite() total_success_cases += success_cases diff --git a/python/tests/test_agent.py b/python/tests/test_agent.py index 0cde85ad8..a922aed91 100644 --- a/python/tests/test_agent.py +++ b/python/tests/test_agent.py @@ -14,8 +14,6 @@ AppBuilderClient ) - -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAgentRuntime(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_animal_recognize.py b/python/tests/test_animal_recognize.py index 77f050986..751c6e83d 100644 --- a/python/tests/test_animal_recognize.py +++ b/python/tests/test_animal_recognize.py @@ -17,7 +17,6 @@ import appbuilder import os -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAnimalRecognition(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_appbuilder_assistant_trace.py b/python/tests/test_appbuilder_assistant_trace.py index 775e26261..cd599bd54 100644 --- a/python/tests/test_appbuilder_assistant_trace.py +++ b/python/tests/test_appbuilder_assistant_trace.py @@ -75,7 +75,6 @@ def tool_calls(self, status_event): ] ) -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAppBuilderTrace(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_appbuilder_client_chatflow.py b/python/tests/test_appbuilder_client_chatflow.py index c62a4d60f..534ad8c33 100644 --- a/python/tests/test_appbuilder_client_chatflow.py +++ b/python/tests/test_appbuilder_client_chatflow.py @@ -18,7 +18,6 @@ from appbuilder.core.console.appbuilder_client import data_class -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAppBuilderClientChatflow(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_appbuilder_client_chatflow_event_handler.py b/python/tests/test_appbuilder_client_chatflow_event_handler.py index db82da1ee..00c5e7a5e 100644 --- a/python/tests/test_appbuilder_client_chatflow_event_handler.py +++ b/python/tests/test_appbuilder_client_chatflow_event_handler.py @@ -49,7 +49,6 @@ def run(self, query=None): ) -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAppBuilderClientChatflow(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_appbuilder_client_chatflow_event_handler_v2.py b/python/tests/test_appbuilder_client_chatflow_event_handler_v2.py index 3ca9cb52b..c2f845976 100644 --- a/python/tests/test_appbuilder_client_chatflow_event_handler_v2.py +++ b/python/tests/test_appbuilder_client_chatflow_event_handler_v2.py @@ -47,7 +47,6 @@ def gen_action(self): yield self._create_action() -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAppBuilderClientChatflow(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_appbuilder_client_trace.py b/python/tests/test_appbuilder_client_trace.py index c92110b27..51566885b 100644 --- a/python/tests/test_appbuilder_client_trace.py +++ b/python/tests/test_appbuilder_client_trace.py @@ -20,7 +20,6 @@ from appbuilder.utils.trace.phoenix_wrapper import runtime_main,stop_phoenix,launch_phoenix from appbuilder.core.console.appbuilder_client import get_app_list -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAppBuilderTrace(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_appbuilder_components_trace.py b/python/tests/test_appbuilder_components_trace.py index 494651923..87bc4ef8e 100644 --- a/python/tests/test_appbuilder_components_trace.py +++ b/python/tests/test_appbuilder_components_trace.py @@ -37,7 +37,6 @@ '时候也需特别注意火侯,这样吃起来才会有外脆内Q的口感!') TEST_ANSWER = '澳门新麻蒲烤肉店并不是每天开门,周日休息。' -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAppBuilderComponentsTrace(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_appbuilder_core_components_retriever.py b/python/tests/test_appbuilder_core_components_retriever.py index 84b330ff4..84d3074c3 100644 --- a/python/tests/test_appbuilder_core_components_retriever.py +++ b/python/tests/test_appbuilder_core_components_retriever.py @@ -20,7 +20,6 @@ from appbuilder.core.components.retriever.baidu_vdb.component import _try_import,BaiduVDBVectorStoreIndex -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAppbuilderCoreComponentsRetriever__try_import(unittest.TestCase): def test_baidu_vdb_baiduvdb_retriever_try_import(self): subprocess.check_call([sys.executable, "-m", "pip", "uninstall", "-y", "pymochow"]) diff --git a/python/tests/test_appbuilder_sentry_trace_off.py b/python/tests/test_appbuilder_sentry_trace_off.py index 80d30dab5..ac7111a0d 100644 --- a/python/tests/test_appbuilder_sentry_trace_off.py +++ b/python/tests/test_appbuilder_sentry_trace_off.py @@ -25,7 +25,6 @@ logging.basicConfig(level=logging.INFO) -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAppbuilderForSentryOff(unittest.TestCase): def test_sentry_inport_error(self): diff --git a/python/tests/test_appbuilder_sentry_trace_on.py b/python/tests/test_appbuilder_sentry_trace_on.py index 48b66ce12..1a426aa24 100644 --- a/python/tests/test_appbuilder_sentry_trace_on.py +++ b/python/tests/test_appbuilder_sentry_trace_on.py @@ -25,7 +25,6 @@ logging.basicConfig(level=logging.INFO) -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAppbuilderForSentryOff(unittest.TestCase): def test_sentry_normal(self): """ diff --git a/python/tests/test_appbuilder_trace_raise_error.py b/python/tests/test_appbuilder_trace_raise_error.py index 9b3d13e75..e611b5c2d 100644 --- a/python/tests/test_appbuilder_trace_raise_error.py +++ b/python/tests/test_appbuilder_trace_raise_error.py @@ -19,7 +19,6 @@ from appbuilder.utils.trace._function import _input,_client_trace_generator,_assistant_stream_run_with_handler_output -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAppbuilderTraceRaiseError(unittest.TestCase): def setUp(self): tracer_provider = trace.get_tracer_provider() diff --git a/python/tests/test_assistant_basic_import.py b/python/tests/test_assistant_basic_import.py index b74f12a8a..31440a40c 100644 --- a/python/tests/test_assistant_basic_import.py +++ b/python/tests/test_assistant_basic_import.py @@ -2,7 +2,6 @@ import os import appbuilder -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAssistantImport(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_assistant_class_assistans.py b/python/tests/test_assistant_class_assistans.py index bd967f0b7..de4bb1ae9 100644 --- a/python/tests/test_assistant_class_assistans.py +++ b/python/tests/test_assistant_class_assistans.py @@ -3,7 +3,6 @@ import appbuilder from tests.pytest_utils import Utils -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAssistant(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_assistant_class_files.py b/python/tests/test_assistant_class_files.py index 91547c05c..9c75cf80f 100644 --- a/python/tests/test_assistant_class_files.py +++ b/python/tests/test_assistant_class_files.py @@ -5,7 +5,6 @@ from appbuilder.core._exception import AssistantServerException from tests.pytest_utils import Utils -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestFilesCreate(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_assistant_class_messages.py b/python/tests/test_assistant_class_messages.py index 44bd5e926..892265f16 100644 --- a/python/tests/test_assistant_class_messages.py +++ b/python/tests/test_assistant_class_messages.py @@ -4,7 +4,6 @@ from appbuilder.core._exception import AssistantServerException -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestMessageCreate(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_assistant_class_runs.py b/python/tests/test_assistant_class_runs.py index af2aba9a9..da19f1a11 100644 --- a/python/tests/test_assistant_class_runs.py +++ b/python/tests/test_assistant_class_runs.py @@ -34,7 +34,6 @@ def get_data_file(filename): def get_cur_whether(location:str, unit:str): return "{} 的当前温度是30 {}".format(location, unit) -# @unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestFunctionCall(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_assistant_class_runs_v2.py b/python/tests/test_assistant_class_runs_v2.py index 784a6ce23..b4266d243 100644 --- a/python/tests/test_assistant_class_runs_v2.py +++ b/python/tests/test_assistant_class_runs_v2.py @@ -2,7 +2,7 @@ import os import appbuilder -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") + def get_cur_whether(location:str, unit:str): return "{} 的当前温度是30 {}".format(location, unit) @@ -61,10 +61,6 @@ def test_run_step_list_v1(self): step_id=last_step_id, ) self.assertEqual(step.id, last_step_id) - - - - if __name__ == '__main__': diff --git a/python/tests/test_assistant_class_threads.py b/python/tests/test_assistant_class_threads.py index d070487da..f90c386c4 100644 --- a/python/tests/test_assistant_class_threads.py +++ b/python/tests/test_assistant_class_threads.py @@ -2,7 +2,6 @@ import os import appbuilder -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestThreadCreate(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_assistant_e2e_funccall.py b/python/tests/test_assistant_e2e_funccall.py index 0d9a22334..90018df2c 100644 --- a/python/tests/test_assistant_e2e_funccall.py +++ b/python/tests/test_assistant_e2e_funccall.py @@ -30,7 +30,6 @@ def get_cur_whether(location:str, unit:str): } } -# @unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") @unittest.skip(reason="暂时跳过") class TestFunctionCall(unittest.TestCase): def setUp(self): diff --git a/python/tests/test_assistant_e2e_funccall_component.py b/python/tests/test_assistant_e2e_funccall_component.py index dd26eb20d..1777ab7f5 100644 --- a/python/tests/test_assistant_e2e_funccall_component.py +++ b/python/tests/test_assistant_e2e_funccall_component.py @@ -3,7 +3,6 @@ import appbuilder -# @unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") @unittest.skip(reason="暂时跳过") class TestFunctionCall(unittest.TestCase): def setUp(self): diff --git a/python/tests/test_assistant_e2e_run.py b/python/tests/test_assistant_e2e_run.py index 30c5d75f7..11359ec97 100644 --- a/python/tests/test_assistant_e2e_run.py +++ b/python/tests/test_assistant_e2e_run.py @@ -3,7 +3,6 @@ import os import appbuilder -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAssistantTalk(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_assistant_e2e_stream_cancel.py b/python/tests/test_assistant_e2e_stream_cancel.py index 0d3ae6b36..a1c0737fb 100644 --- a/python/tests/test_assistant_e2e_stream_cancel.py +++ b/python/tests/test_assistant_e2e_stream_cancel.py @@ -31,7 +31,6 @@ def get_cur_whether(location:str, unit:str): } } -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestCancel(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_assistant_e2e_stream_event_handler.py b/python/tests/test_assistant_e2e_stream_event_handler.py index 28d383871..fddb99789 100644 --- a/python/tests/test_assistant_e2e_stream_event_handler.py +++ b/python/tests/test_assistant_e2e_stream_event_handler.py @@ -56,7 +56,6 @@ def tool_calls(self, status_event): ) -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestFunctionCall(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_assistant_e2e_stream_event_handler_v2.py b/python/tests/test_assistant_e2e_stream_event_handler_v2.py index bd74619f7..0fefbb868 100644 --- a/python/tests/test_assistant_e2e_stream_event_handler_v2.py +++ b/python/tests/test_assistant_e2e_stream_event_handler_v2.py @@ -63,7 +63,6 @@ def tool_calls(self, status_event): ) -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestFunctionCall(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_assistant_e2e_stream_funccall.py b/python/tests/test_assistant_e2e_stream_funccall.py index 7b4c27586..efef8261e 100644 --- a/python/tests/test_assistant_e2e_stream_funccall.py +++ b/python/tests/test_assistant_e2e_stream_funccall.py @@ -30,7 +30,6 @@ def get_cur_whether(location:str, unit:str): } } -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestFunctionCall(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_assistant_e2e_stream_run.py b/python/tests/test_assistant_e2e_stream_run.py index d7be0f9da..abb164989 100644 --- a/python/tests/test_assistant_e2e_stream_run.py +++ b/python/tests/test_assistant_e2e_stream_run.py @@ -4,7 +4,6 @@ import time import appbuilder -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestAssistantStreamTalk(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TOKEN"] = os.environ["APPBUILDER_TOKEN_V2"] diff --git a/python/tests/test_console_rag.py b/python/tests/test_console_rag.py index 5874f6270..09d2b9aca 100644 --- a/python/tests/test_console_rag.py +++ b/python/tests/test_console_rag.py @@ -17,7 +17,6 @@ from appbuilder.core.console.rag.rag import RAG -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestRag(unittest.TestCase): def setUp(self): diff --git a/python/tests/test_core_client.py b/python/tests/test_core_client.py index c35c4c3b3..1cd654408 100644 --- a/python/tests/test_core_client.py +++ b/python/tests/test_core_client.py @@ -28,7 +28,6 @@ def __init__(self, status_code, headers, text): def json(self): return json.loads(self.text) -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestCoreClient(unittest.TestCase): def setUp(self): # 保存原始环境变量 diff --git a/python/tests/test_dialog_summary.py b/python/tests/test_dialog_summary.py index 9362fa2ee..7c7aac454 100644 --- a/python/tests/test_dialog_summary.py +++ b/python/tests/test_dialog_summary.py @@ -16,7 +16,6 @@ import unittest import appbuilder -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestDialogSummary(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_doc_crop_enhance.py b/python/tests/test_doc_crop_enhance.py index 8cb8d1822..864810952 100644 --- a/python/tests/test_doc_crop_enhance.py +++ b/python/tests/test_doc_crop_enhance.py @@ -16,7 +16,6 @@ import requests import appbuilder import os -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestDocCropEnhance(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_gbi_nl2sql.py b/python/tests/test_gbi_nl2sql.py index 65a2dca21..3c9031f92 100644 --- a/python/tests/test_gbi_nl2sql.py +++ b/python/tests/test_gbi_nl2sql.py @@ -69,7 +69,6 @@ 当前问题:"{query}" 回答: """ -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestGBINL2Sql(unittest.TestCase): def setUp(self): diff --git a/python/tests/test_gbi_select_table.py b/python/tests/test_gbi_select_table.py index ed3477583..1ef8cb12d 100644 --- a/python/tests/test_gbi_select_table.py +++ b/python/tests/test_gbi_select_table.py @@ -68,7 +68,6 @@ 问题:{query} 回答: """ -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestGBISelectTable(unittest.TestCase): def setUp(self): diff --git a/python/tests/test_hallucination_detection.py b/python/tests/test_hallucination_detection.py index dec2f82cd..871159fac 100644 --- a/python/tests/test_hallucination_detection.py +++ b/python/tests/test_hallucination_detection.py @@ -38,7 +38,6 @@ TEST_ANSWER = '澳门新麻蒲烤肉店并不是每天开门,周日休息。' -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestHallucinationDetectionComponent(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_knowledge_base.py b/python/tests/test_knowledge_base.py index 81e2777bf..6a7702231 100644 --- a/python/tests/test_knowledge_base.py +++ b/python/tests/test_knowledge_base.py @@ -17,7 +17,6 @@ from appbuilder.core._exception import BadRequestException -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestKnowLedge(unittest.TestCase): def setUp(self): self.whether_create_knowledge_base = False diff --git a/python/tests/test_matching.py b/python/tests/test_matching.py index a65da16f9..a65af315f 100644 --- a/python/tests/test_matching.py +++ b/python/tests/test_matching.py @@ -10,7 +10,6 @@ import os import appbuilder -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestMatching(unittest.TestCase): def test_example(self): diff --git a/python/tests/test_mrc.py b/python/tests/test_mrc.py index bcf36f89c..10376e6ad 100644 --- a/python/tests/test_mrc.py +++ b/python/tests/test_mrc.py @@ -16,7 +16,6 @@ import appbuilder import time -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestMRC(unittest.TestCase): def setUp(self): ''' diff --git a/python/tests/test_nl2pandas.py b/python/tests/test_nl2pandas.py index adde549a8..8d7ebd147 100644 --- a/python/tests/test_nl2pandas.py +++ b/python/tests/test_nl2pandas.py @@ -19,7 +19,6 @@ from appbuilder.core.message import Message -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestNl2pandasComponent(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_oral_query_generation.py b/python/tests/test_oral_query_generation.py index c9b497f17..46f741048 100644 --- a/python/tests/test_oral_query_generation.py +++ b/python/tests/test_oral_query_generation.py @@ -23,7 +23,6 @@ ',实时视频分享您的生活。') -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestOralQueryGenerationComponent(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_qa_llm_excel2figure.py b/python/tests/test_qa_llm_excel2figure.py index 290ab5fc8..e5c8f0594 100644 --- a/python/tests/test_qa_llm_excel2figure.py +++ b/python/tests/test_qa_llm_excel2figure.py @@ -77,7 +77,6 @@ def get_data_file(filename): "bce-auth-v1/e464e6f951124fdbb2410c590ef9ed2f/2024-02-21T09%3A51%3A14Z/-1/host/1802a9c9142ef328d6" ) -# @unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestExcel2figure(unittest.TestCase): # @parameterized.expand([ # param("ERNIE-Bot 4.0", "2020年各个月份的利润分别是多少?使用条形图绘制出来", file_bos_url), diff --git a/python/tests/test_qa_pair_mining.py b/python/tests/test_qa_pair_mining.py index 111d0dc06..ce3c6c822 100644 --- a/python/tests/test_qa_pair_mining.py +++ b/python/tests/test_qa_pair_mining.py @@ -19,7 +19,6 @@ import appbuilder -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestQAPairMiningComponent(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_qrcode_ocr.py b/python/tests/test_qrcode_ocr.py index 6ba3d9603..a6fd6eb6a 100644 --- a/python/tests/test_qrcode_ocr.py +++ b/python/tests/test_qrcode_ocr.py @@ -19,7 +19,6 @@ from appbuilder.core._exception import InvalidRequestArgumentError -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestQRcodeOCR(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_rerank.py b/python/tests/test_rerank.py index f0045112e..e632791a5 100644 --- a/python/tests/test_rerank.py +++ b/python/tests/test_rerank.py @@ -9,7 +9,6 @@ import appbuilder -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestReranker(unittest.TestCase): def setUp(self): diff --git a/python/tests/test_similar_question.py b/python/tests/test_similar_question.py index 97d8b8d46..346748954 100644 --- a/python/tests/test_similar_question.py +++ b/python/tests/test_similar_question.py @@ -16,7 +16,6 @@ import os import appbuilder -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestSimilarQuestionComponent(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_style_rewrite.py b/python/tests/test_style_rewrite.py index 4e99b6279..6bc572078 100644 --- a/python/tests/test_style_rewrite.py +++ b/python/tests/test_style_rewrite.py @@ -19,7 +19,6 @@ from appbuilder.core.components.llms.style_rewrite.base import StyleChoices import appbuilder -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestStyleRewriteComponent(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_style_writing.py b/python/tests/test_style_writing.py index 7f8b5c27a..a4c3909da 100644 --- a/python/tests/test_style_writing.py +++ b/python/tests/test_style_writing.py @@ -20,7 +20,6 @@ from appbuilder.core.components.llms.style_writing.component import StyleQueryChoices, LengthChoices -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestStyleWritingComponent(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_table_ocr.py b/python/tests/test_table_ocr.py index 85265658d..23117f5ff 100644 --- a/python/tests/test_table_ocr.py +++ b/python/tests/test_table_ocr.py @@ -19,7 +19,6 @@ from appbuilder.core._exception import InvalidRequestArgumentError -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestTableOCR(unittest.TestCase): def setUp(self): """ diff --git a/python/tests/test_trace_skip_raise_error.py b/python/tests/test_trace_skip_raise_error.py index 7083aed37..e465dc63b 100644 --- a/python/tests/test_trace_skip_raise_error.py +++ b/python/tests/test_trace_skip_raise_error.py @@ -111,7 +111,6 @@ def mock_list_trace_01(): def mock_list_trace_02(): raise TestException() -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestTraceSkipRaiseError(unittest.TestCase): def setUp(self): os.environ["APPBUILDER_TRACE_DEBUG"] = "True" diff --git a/python/tests/test_treemind.py b/python/tests/test_treemind.py index 823c9e13f..809f7c755 100644 --- a/python/tests/test_treemind.py +++ b/python/tests/test_treemind.py @@ -16,7 +16,6 @@ from appbuilder.core.message import Message from appbuilder import TreeMind -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_SERIAL", "") class TestTreeMindComponent(unittest.TestCase): def setUp(self): """