From 858f39629f05f94ca29b7c4d0445e0b480d13cd8 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Tue, 16 Jan 2024 16:27:21 -0800 Subject: [PATCH] (ci/cd) use fixture --- litellm/tests/test_proxy_startup.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/litellm/tests/test_proxy_startup.py b/litellm/tests/test_proxy_startup.py index c033505bbd0..33e317ccf8b 100644 --- a/litellm/tests/test_proxy_startup.py +++ b/litellm/tests/test_proxy_startup.py @@ -24,7 +24,14 @@ from litellm.proxy.proxy_server import ( ) -def test_proxy_gunicorn_startup_direct_config(): +@pytest.fixture +def cleanup_router_config(): + from litellm.proxy.proxy_server import cleanup_router_config_variables + + cleanup_router_config_variables() + + +def test_proxy_gunicorn_startup_direct_config(cleanup_router_config): """ gunicorn startup requires the config to be passed in via environment variables @@ -33,9 +40,6 @@ def test_proxy_gunicorn_startup_direct_config(): Test both approaches """ try: - from litellm.proxy.proxy_server import cleanup_router_config_variables - - cleanup_router_config_variables() filepath = os.path.dirname(os.path.abspath(__file__)) # test with worker_config = config yaml config_fp = f"{filepath}/test_configs/test_config_no_auth.yaml" @@ -49,11 +53,8 @@ def test_proxy_gunicorn_startup_direct_config(): pytest.fail(f"An exception occurred - {str(e)}") -def test_proxy_gunicorn_startup_config_dict(): +def test_proxy_gunicorn_startup_config_dict(cleanup_router_config): try: - from litellm.proxy.proxy_server import cleanup_router_config_variables - - cleanup_router_config_variables() filepath = os.path.dirname(os.path.abspath(__file__)) # test with worker_config = config yaml config_fp = f"{filepath}/test_configs/test_config_no_auth.yaml"