Skip to content

Commit

Permalink
更新单元测试
Browse files Browse the repository at this point in the history
  • Loading branch information
yinjiaqi authored and yinjiaqi committed Oct 24, 2024
1 parent dd4ac9d commit f4cdded
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions appbuilder/tests/test_trace_skip_raise_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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()

0 comments on commit f4cdded

Please sign in to comment.