Skip to content

Commit ba013ec

Browse files
committed
feat(tests): tests pipeline
1 parent 99de663 commit ba013ec

12 files changed

Lines changed: 47 additions & 23 deletions

.github/workflows/langchain_ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
uses: ./.github/workflows/test.yml
2525
with:
2626
folder_path: "."
27+
secrets:
28+
UIPATH_URL: ${{ secrets.UIPATH_URL }}
29+
UIPATH_CLIENT_ID: ${{ secrets.UIPATH_CLIENT_ID }}
30+
UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}
2731

2832
build:
2933
needs: [lint, test]

.github/workflows/test.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ name: Reusable Test Workflow
22

33
on:
44
workflow_call:
5+
secrets:
6+
UIPATH_URL:
7+
required: true
8+
UIPATH_CLIENT_ID:
9+
required: true
10+
UIPATH_CLIENT_SECRET:
11+
required: true
512
inputs:
6-
713
folder_path:
814
description: 'The folder path to run actions in'
915
required: true
@@ -39,11 +45,10 @@ jobs:
3945
4046
- name: "Run tests"
4147
run: |
48+
printenv
4249
uv run pytest
4350
env:
4451
UIPATH_URL: ${{ secrets.UIPATH_URL }}
4552
UIPATH_CLIENT_ID: ${{ secrets.UIPATH_CLIENT_ID }}
4653
UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}
47-
UIPATH_ORGANIZATION_ID: ${{ vars.UIPATH_ORGANIZATION_ID }}
48-
UIPATH_TENANT_ID: ${{ vars.UIPATH_TENANT_ID }}
4954

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"titleBar.inactiveBackground": "#0099cc"
2222
},
2323
"python.testing.pytestArgs": [
24-
"sdk"
24+
"tests"
2525
],
2626
"python.testing.unittestEnabled": false,
2727
"python.testing.pytestEnabled": true

src/uipath_langchain/_utils/tests/cached_embeddings/text-embedding-3-largec48857ed-1302-5954-9e24-69fa9b45e457

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/uipath_langchain/_utils/tests/tests_uipath_cache.db

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/uipath_langchain/utils/tests/cached_embeddings/text-embedding-3-large5034ec3c-85c9-54b8-ac89-5e0cbcf99e3b

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/uipath_langchain/utils/tests/cached_embeddings/text-embedding-3-largec48857ed-1302-5954-9e24-69fa9b45e457

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/uipath_langchain/utils/tests/tests_uipath_cache.db

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/conftest.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from os import environ as env
44
from typing import Generator, Optional
55

6+
import dotenv
67
import httpx
78
import pytest
89
from langchain.embeddings import CacheBackedEmbeddings
@@ -11,11 +12,34 @@
1112
from langchain_community.cache import SQLiteCache
1213

1314
from uipath_langchain.embeddings import UiPathOpenAIEmbeddings
14-
from uipath_langchain.utils._settings import uipath_cached_paths_settings
15+
from uipath_langchain.utils._settings import (
16+
UiPathCachedPathsSettings,
17+
)
18+
19+
dotenv.load_dotenv()
20+
21+
test_cache_settings = UiPathCachedPathsSettings(
22+
CACHED_COMPLETION_DB="tests/llm_cache/tests_uipath_cache.db",
23+
CACHED_EMBEDDINGS_DIR="tests/llm_cache/cached_embeddings",
24+
)
25+
26+
27+
def get_from_uipath_url():
28+
try:
29+
url = os.getenv("UIPATH_URL")
30+
if url:
31+
return "/".join(url.split("/", 3)[:3])
32+
except Exception:
33+
return None
34+
return None
1535

1636

1737
def get_token():
18-
url_get_token = f"{env.get('UIPATH_URL', '').rstrip('/')}/identity_/connect/token"
38+
url_get_token = f"{get_from_uipath_url().rstrip('/')}/identity_/connect/token"
39+
40+
os.environ["UIPATH_REQUESTING_PRODUCT"] = "uipath-python-sdk"
41+
os.environ["UIPATH_REQUESTING_FEATURE"] = "langgraph-agent"
42+
os.environ["UIPATH_TESTS_CACHE_LLMGW"] = "true"
1943

2044
token_credentials = {
2145
"client_id": env.get("UIPATH_CLIENT_ID"),
@@ -49,7 +73,7 @@ def cached_llmgw_calls() -> Generator[Optional[SQLiteCache], None, None]:
4973
yield None
5074
else:
5175
logging.info("Setting up LLMGW cache")
52-
db_path = uipath_cached_paths_settings.cached_completion_db
76+
db_path = test_cache_settings.cached_completion_db
5377
os.makedirs(os.path.dirname(db_path), exist_ok=True)
5478
cache = SQLiteCache(database_path=db_path)
5579
set_llm_cache(cache)
@@ -68,7 +92,7 @@ def cached_embedder() -> Generator[Optional[CacheBackedEmbeddings], None, None]:
6892
embedder = CacheBackedEmbeddings.from_bytes_store(
6993
underlying_embeddings=UiPathOpenAIEmbeddings(model=model),
7094
document_embedding_cache=LocalFileStore(
71-
uipath_cached_paths_settings.cached_embeddings_dir
95+
test_cache_settings.cached_embeddings_dir
7296
),
7397
namespace=model,
7498
)

src/uipath_langchain/_utils/tests/cached_embeddings/text-embedding-3-large5034ec3c-85c9-54b8-ac89-5e0cbcf99e3b renamed to tests/llm_cache/cached_embeddings/text-embedding-3-large5034ec3c-85c9-54b8-ac89-5e0cbcf99e3b

File renamed without changes.

0 commit comments

Comments
 (0)