Skip to content

Commit 397d200

Browse files
committed
Skip if less than 3.8
1 parent b975ec1 commit 397d200

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

tests/test_open_ai_mixin.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import sys
2+
3+
import pytest
4+
25
from databricks.sdk.core import Config
36

47

@@ -14,19 +17,14 @@ def test_open_ai_client(monkeypatch):
1417
assert client.api_key == "test_token"
1518

1619

20+
@pytest.mark.skipif(sys.version_info < (3, 8), reason="Requires Python > 3.7")
1721
def test_langchain_open_ai_client(monkeypatch):
1822
from databricks.sdk import WorkspaceClient
19-
print(sys.version_info)
20-
print(sys.version_info <= (3,7))
21-
if sys.version_info <= (3, 7):
22-
with pytest.raises(ImportError):
23-
w = WorkspaceClient(config=Config())
24-
client = w.serving_endpoints.get_langchain_chat_open_ai_client("databricks-meta-llama-3-1-70b-instruct")
25-
else:
26-
monkeypatch.setenv('DATABRICKS_HOST', 'test_host')
27-
monkeypatch.setenv('DATABRICKS_TOKEN', 'test_token')
28-
w = WorkspaceClient(config=Config())
29-
client = w.serving_endpoints.get_langchain_chat_open_ai_client("databricks-meta-llama-3-1-70b-instruct")
30-
31-
assert client.openai_api_base == "https://test_host/serving-endpoints"
32-
assert client.model_name == "databricks-meta-llama-3-1-70b-instruct"
23+
24+
monkeypatch.setenv('DATABRICKS_HOST', 'test_host')
25+
monkeypatch.setenv('DATABRICKS_TOKEN', 'test_token')
26+
w = WorkspaceClient(config=Config())
27+
client = w.serving_endpoints.get_langchain_chat_open_ai_client("databricks-meta-llama-3-1-70b-instruct")
28+
29+
assert client.openai_api_base == "https://test_host/serving-endpoints"
30+
assert client.model_name == "databricks-meta-llama-3-1-70b-instruct"

0 commit comments

Comments
 (0)