Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

sys.path.insert for cli tests

Ishaan Jaff782ba9f5a003
diff --git a/tests/test_litellm/proxy/client/cli/test_auth_commands.py b/tests/test_litellm/proxy/client/cli/test_auth_commands.py
index 33e5ba29bf0..611fde7767e 100644
--- a/tests/test_litellm/proxy/client/cli/test_auth_commands.py
+++ b/tests/test_litellm/proxy/client/cli/test_auth_commands.py
@@ -1,10 +1,16 @@
import json
import os
+import sys
import tempfile
import time
from pathlib import Path
from unittest.mock import MagicMock, Mock, mock_open, patch
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
import pytest
from click.testing import CliRunner
diff --git a/tests/test_litellm/proxy/client/cli/test_chat_commands.py b/tests/test_litellm/proxy/client/cli/test_chat_commands.py
index 0b785f4962c..1226c3557ff 100644
--- a/tests/test_litellm/proxy/client/cli/test_chat_commands.py
+++ b/tests/test_litellm/proxy/client/cli/test_chat_commands.py
@@ -1,10 +1,17 @@
import json
+import os
+import sys
from unittest.mock import MagicMock, patch
import pytest
import requests
from click.testing import CliRunner
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
from litellm.proxy.client.cli.main import cli
diff --git a/tests/test_litellm/proxy/client/cli/test_credentials_commands.py b/tests/test_litellm/proxy/client/cli/test_credentials_commands.py
index cae9e79d797..9ad2bd067f3 100644
--- a/tests/test_litellm/proxy/client/cli/test_credentials_commands.py
+++ b/tests/test_litellm/proxy/client/cli/test_credentials_commands.py
@@ -1,10 +1,17 @@
import json
+import os
+import sys
from unittest.mock import MagicMock, patch
import pytest
import requests
from click.testing import CliRunner
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
from litellm.proxy.client.cli.main import cli
diff --git a/tests/test_litellm/proxy/client/cli/test_global_options.py b/tests/test_litellm/proxy/client/cli/test_global_options.py
index b14bfdf92af..980556893a1 100644
--- a/tests/test_litellm/proxy/client/cli/test_global_options.py
+++ b/tests/test_litellm/proxy/client/cli/test_global_options.py
@@ -1,10 +1,16 @@
# stdlib imports
import os
+import sys
from unittest.mock import patch
import pytest
from click.testing import CliRunner
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
from litellm._version import version as litellm_version
from litellm.proxy.client.cli import cli
diff --git a/tests/test_litellm/proxy/client/cli/test_models_commands.py b/tests/test_litellm/proxy/client/cli/test_models_commands.py
index 16744f4a895..7f47d14656a 100644
--- a/tests/test_litellm/proxy/client/cli/test_models_commands.py
+++ b/tests/test_litellm/proxy/client/cli/test_models_commands.py
@@ -1,6 +1,7 @@
# stdlib imports
import json
import os
+import sys
import time
from unittest.mock import patch
@@ -9,6 +10,11 @@ import pytest
# third party imports
from click.testing import CliRunner
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
# local imports
from litellm.proxy.client.cli import cli
from litellm.proxy.client.cli.commands.models import (
diff --git a/tests/test_litellm/proxy/client/cli/test_users_commands.py b/tests/test_litellm/proxy/client/cli/test_users_commands.py
index 9b291c4ec9d..f18ceb30c22 100644
--- a/tests/test_litellm/proxy/client/cli/test_users_commands.py
+++ b/tests/test_litellm/proxy/client/cli/test_users_commands.py
@@ -1,8 +1,15 @@
+import os
+import sys
from unittest.mock import patch
import pytest
from click.testing import CliRunner
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
from litellm.proxy.client.cli import cli
diff --git a/tests/test_litellm/proxy/client/test_chat.py b/tests/test_litellm/proxy/client/test_chat.py
index 2fd5a4a26ff..332edc78575 100644
--- a/tests/test_litellm/proxy/client/test_chat.py
+++ b/tests/test_litellm/proxy/client/test_chat.py
@@ -1,6 +1,14 @@
+import os
+import sys
+
import pytest
import requests
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
from litellm.proxy.client.chat import ChatClient
from litellm.proxy.client.exceptions import UnauthorizedError
diff --git a/tests/test_litellm/proxy/client/test_client.py b/tests/test_litellm/proxy/client/test_client.py
index 267e9f074a4..c97094802ce 100644
--- a/tests/test_litellm/proxy/client/test_client.py
+++ b/tests/test_litellm/proxy/client/test_client.py
@@ -1,5 +1,12 @@
+import os
+import sys
+
import pytest
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
from litellm.proxy.client import ChatClient, Client, ModelsManagementClient
from litellm.proxy.client.http_client import HTTPClient
from litellm.proxy.client.keys import KeysManagementClient
diff --git a/tests/test_litellm/proxy/client/test_credentials.py b/tests/test_litellm/proxy/client/test_credentials.py
index ef0cc9998c8..a83e1cf0cde 100644
--- a/tests/test_litellm/proxy/client/test_credentials.py
+++ b/tests/test_litellm/proxy/client/test_credentials.py
@@ -1,6 +1,14 @@
+import os
+import sys
+
import pytest
import requests
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
from litellm.proxy.client.credentials import CredentialsManagementClient
from litellm.proxy.client.exceptions import UnauthorizedError
diff --git a/tests/test_litellm/proxy/client/test_http_client.py b/tests/test_litellm/proxy/client/test_http_client.py
index 30bb1489c58..3bb6c4cef84 100644
--- a/tests/test_litellm/proxy/client/test_http_client.py
+++ b/tests/test_litellm/proxy/client/test_http_client.py
@@ -1,11 +1,18 @@
"""Tests for the HTTP client."""
import json
+import os
+import sys
import pytest
import requests
import responses
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
from litellm.proxy.client.http_client import HTTPClient
diff --git a/tests/test_litellm/proxy/client/test_http_commands.py b/tests/test_litellm/proxy/client/test_http_commands.py
index f305efb3354..d1dea3a5541 100644
--- a/tests/test_litellm/proxy/client/test_http_commands.py
+++ b/tests/test_litellm/proxy/client/test_http_commands.py
@@ -1,11 +1,18 @@
"""Tests for the HTTP command group."""
import json
+import os
+import sys
import pytest
import responses
from click.testing import CliRunner
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
from litellm.proxy.client.cli.commands.http import http
diff --git a/tests/test_litellm/proxy/client/test_keys.py b/tests/test_litellm/proxy/client/test_keys.py
index 7ce4452bdc2..4e341e8ea7d 100644
--- a/tests/test_litellm/proxy/client/test_keys.py
+++ b/tests/test_litellm/proxy/client/test_keys.py
@@ -1,6 +1,14 @@
+import os
+import sys
+
import pytest
import requests
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
from litellm.proxy.client.exceptions import UnauthorizedError
from litellm.proxy.client.keys import KeysManagementClient
diff --git a/tests/test_litellm/proxy/client/test_model_groups.py b/tests/test_litellm/proxy/client/test_model_groups.py
index 0afb253149b..4642d96170f 100644
--- a/tests/test_litellm/proxy/client/test_model_groups.py
+++ b/tests/test_litellm/proxy/client/test_model_groups.py
@@ -1,6 +1,14 @@
+import os
+import sys
+
import pytest
import requests
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
from litellm.proxy.client import Client, ModelGroupsManagementClient
from litellm.proxy.client.exceptions import UnauthorizedError
diff --git a/tests/test_litellm/proxy/client/test_models.py b/tests/test_litellm/proxy/client/test_models.py
index afd042682b4..1f991d3a1c0 100644
--- a/tests/test_litellm/proxy/client/test_models.py
+++ b/tests/test_litellm/proxy/client/test_models.py
@@ -1,6 +1,15 @@
+import os
+import sys
+
import pytest
import requests
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
+
from litellm.proxy.client import Client, ModelsManagementClient
from litellm.proxy.client.exceptions import NotFoundError, UnauthorizedError
diff --git a/tests/test_litellm/proxy/client/test_users.py b/tests/test_litellm/proxy/client/test_users.py
index 5bcd783b914..a48cf8f791b 100644
--- a/tests/test_litellm/proxy/client/test_users.py
+++ b/tests/test_litellm/proxy/client/test_users.py
@@ -1,7 +1,14 @@
+import os
+import sys
from unittest.mock import MagicMock, patch
import pytest
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+
from litellm.proxy.client.users import (
NotFoundError,
UnauthorizedError,