From f4cddedf72f9f57f8f66eea4953b90cac77b2690 Mon Sep 17 00:00:00 2001 From: yinjiaqi Date: Thu, 24 Oct 2024 16:36:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/test_trace_skip_raise_error.py | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/appbuilder/tests/test_trace_skip_raise_error.py b/appbuilder/tests/test_trace_skip_raise_error.py index e1066ab8..7083aed3 100644 --- a/appbuilder/tests/test_trace_skip_raise_error.py +++ b/appbuilder/tests/test_trace_skip_raise_error.py @@ -133,6 +133,10 @@ def test_session_post(self): with self.assertRaises(TestException): mock_post_02() + os.environ["APPBUILDER_SDK_TRACE_ENABLE"] = "false" + with self.assertRaises(Exception): + mock_post_02() + def test_client_run_trace(self): # test_client_run_trace APPBUILDER_TRACE_DEBUG = true os.environ["APPBUILDER_TRACE_DEBUG"] = "true" @@ -145,6 +149,10 @@ def test_client_run_trace(self): with self.assertRaises(TestException): mock_client_run_trace_02() + os.environ["APPBUILDER_SDK_TRACE_ENABLE"] = "false" + with self.assertRaises(Exception): + mock_client_run_trace_02() + def test_client_tool_trace(self): # test_client_tool_trace APPBUILDER_TRACE_DEBUG = true os.environ["APPBUILDER_TRACE_DEBUG"] = "true" @@ -157,6 +165,10 @@ def test_client_tool_trace(self): with self.assertRaises(TestException): mock_client_tool_trace_02() + os.environ["APPBUILDER_SDK_TRACE_ENABLE"] = "false" + with self.assertRaises(Exception): + mock_client_tool_trace_02() + def test_assistent_tool_trace(self): # test_assistent_tool_trace APPBUILDER_TRACE_DEBUG = true os.environ["APPBUILDER_TRACE_DEBUG"] = "true" @@ -169,6 +181,10 @@ def test_assistent_tool_trace(self): with self.assertRaises(TestException): mock_assistent_tool_trace_02() + os.environ["APPBUILDER_SDK_TRACE_ENABLE"] = "false" + with self.assertRaises(Exception): + mock_assistent_tool_trace_02() + def test_assistant_run_trace(self): # test_assistant_run_trace APPBUILDER_TRACE_DEBUG = true os.environ["APPBUILDER_TRACE_DEBUG"] = "true" @@ -180,6 +196,10 @@ def test_assistant_run_trace(self): mock_assistant_run_trace_01() with self.assertRaises(TestException): mock_assistant_run_trace_02() + + os.environ["APPBUILDER_SDK_TRACE_ENABLE"] = "false" + with self.assertRaises(Exception): + mock_assistant_run_trace_02() def test_assistent_stream_run_trace(self): # test_assistent_stream_run_trace APPBUILDER_TRACE_DEBUG = true @@ -192,6 +212,10 @@ def test_assistent_stream_run_trace(self): mock_assistent_stream_run_trace_01() with self.assertRaises(TestException): mock_assistent_stream_run_trace_02() + + os.environ["APPBUILDER_SDK_TRACE_ENABLE"] = "false" + with self.assertRaises(Exception): + mock_assistent_stream_run_trace_02() def test_assistent_stream_run_with_handler_trace(self): # test_assistent_stream_run_with_handler_trace APPBUILDER_TRACE_DEBUG = true @@ -205,6 +229,10 @@ def test_assistent_stream_run_with_handler_trace(self): with self.assertRaises(TestException): mock_assistent_stream_run_with_handler_trace_02() + os.environ["APPBUILDER_SDK_TRACE_ENABLE"] = "false" + with self.assertRaises(Exception): + mock_assistent_stream_run_with_handler_trace_02() + def test_components_run_trace(self): # test_components_run_trace APPBUILDER_TRACE_DEBUG = true os.environ["APPBUILDER_TRACE_DEBUG"] = "true" @@ -216,6 +244,10 @@ def test_components_run_trace(self): mock_components_run_trace_01() with self.assertRaises(TestException): mock_components_run_trace_02() + + os.environ["APPBUILDER_SDK_TRACE_ENABLE"] = "false" + with self.assertRaises(Exception): + mock_components_run_trace_02() def test_components_run_stream_trace(self): # test_components_run_stream_trace APPBUILDER_TRACE_DEBUG = true @@ -229,6 +261,10 @@ def test_components_run_stream_trace(self): with self.assertRaises(TestException): mock_components_run_stream_trace_02() + os.environ["APPBUILDER_SDK_TRACE_ENABLE"] = "false" + with self.assertRaises(Exception): + mock_components_run_stream_trace_02() + def test_list_trace(self): # test_list_trace APPBUILDER_TRACE_DEBUG = true os.environ["APPBUILDER_TRACE_DEBUG"] = "true" @@ -241,6 +277,10 @@ def test_list_trace(self): with self.assertRaises(TestException): mock_list_trace_02() + os.environ["APPBUILDER_SDK_TRACE_ENABLE"] = "false" + with self.assertRaises(Exception): + mock_list_trace_02() + if __name__ == '__main__': unittest.main()