From cd8ae2ecf64888effbbfa5157bec6b767b9107e8 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 7 Oct 2023 18:10:51 -0700 Subject: [PATCH] test(test_logging): add back more tests for circle ci --- litellm/tests/test_logging.py | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/litellm/tests/test_logging.py b/litellm/tests/test_logging.py index 7187193ad..d0e6ca332 100644 --- a/litellm/tests/test_logging.py +++ b/litellm/tests/test_logging.py @@ -64,30 +64,30 @@ def test_logging_success_completion(): pytest.fail(f"Error occurred: {e}") pass -# ## test on non-openai completion call -# def test_logging_success_completion_non_openai(): -# global score -# try: -# # Redirect stdout -# old_stdout = sys.stdout -# sys.stdout = new_stdout = io.StringIO() +## test on non-openai completion call +def test_logging_success_completion_non_openai(): + global score + try: + # Redirect stdout + old_stdout = sys.stdout + sys.stdout = new_stdout = io.StringIO() -# response = completion(model="claude-instant-1", messages=messages) + response = completion(model="claude-instant-1", messages=messages) -# # Restore stdout -# sys.stdout = old_stdout -# output = new_stdout.getvalue().strip() + # Restore stdout + sys.stdout = old_stdout + output = new_stdout.getvalue().strip() -# if "Logging Details Pre-API Call" not in output: -# raise Exception("Required log message not found!") -# elif "Logging Details Post-API Call" not in output: -# raise Exception("Required log message not found!") -# elif "Logging Details LiteLLM-Success Call" not in output: -# raise Exception("Required log message not found!") -# score += 1 -# except Exception as e: -# pytest.fail(f"Error occurred: {e}") -# pass + if "Logging Details Pre-API Call" not in output: + raise Exception("Required log message not found!") + elif "Logging Details Post-API Call" not in output: + raise Exception("Required log message not found!") + elif "Logging Details LiteLLM-Success Call" not in output: + raise Exception("Required log message not found!") + score += 1 + except Exception as e: + pytest.fail(f"Error occurred: {e}") + pass # # streaming completion # ## test on openai completion call