infra: Clear cache for env-var checks (#26073)

This commit is contained in:
William FH
2024-09-06 14:29:29 -07:00
committed by GitHub
parent 854f37be87
commit 262e19b15d
7 changed files with 22 additions and 12 deletions

8
libs/core/poetry.lock generated
View File

@@ -1253,13 +1253,13 @@ url = "../text-splitters"
[[package]]
name = "langsmith"
version = "0.1.106"
version = "0.1.113"
description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform."
optional = false
python-versions = "<4.0,>=3.8.1"
files = [
{file = "langsmith-0.1.106-py3-none-any.whl", hash = "sha256:a418161c98de72ee2c6eea6667c6217814b67db4b9a3a024788013384216ff35"},
{file = "langsmith-0.1.106.tar.gz", hash = "sha256:64a890a05640d64692f5515ebb444b0457332a9cf9e7605c4651de6737a7d3a0"},
{file = "langsmith-0.1.113-py3-none-any.whl", hash = "sha256:0071d034fbe54cc3574f382b062c4b4f09931dfe7b703146900b7918a7f6c785"},
{file = "langsmith-0.1.113.tar.gz", hash = "sha256:369efa53352bdc4f27d5c8b7f4f802b32492e55511c7fbeeaea143dbfdf0ee06"},
]
[package.dependencies]
@@ -3220,4 +3220,4 @@ type = ["pytest-mypy"]
[metadata]
lock-version = "2.0"
python-versions = ">=3.8.1,<4.0"
content-hash = "e86e28d75744b77f8c2173b58e950c2d23c95cacad8ee5d3110309c4248f7c09"
content-hash = "db22fd24cc4409baa802efebb4a73e8effd50befe465428d7946d91dccbb9563"

View File

@@ -24,7 +24,7 @@ ignore_missing_imports = true
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
langsmith = "^0.1.75"
langsmith = "^0.1.112"
tenacity = "^8.1.0,!=8.4.0"
jsonpatch = "^1.33"
PyYAML = ">=5.3"

View File

@@ -6,6 +6,7 @@ from unittest.mock import MagicMock, patch
import pytest
from langsmith import Client, traceable
from langsmith.run_helpers import tracing_context
from langsmith.utils import get_env_var
from langchain_core.runnables.base import RunnableLambda, RunnableParallel
from langchain_core.tracers.langchain import LangChainTracer
@@ -31,6 +32,7 @@ def _get_posts(client: Client) -> list:
def test_config_traceable_handoff() -> None:
get_env_var.cache_clear()
mock_session = MagicMock()
mock_client_ = Client(
session=mock_session, api_key="test", auto_batch_tracing=False
@@ -186,6 +188,7 @@ def test_tracing_enable_disable(
def my_func(a: int) -> int:
return a + 1
get_env_var.cache_clear()
env_on = env == "true"
with patch.dict("os.environ", {"LANGSMITH_TRACING": env}):
with tracing_context(enabled=enabled):

View File

@@ -9,6 +9,7 @@ from uuid import UUID
import pytest
from langsmith import Client
from langsmith.run_trees import RunTree
from langsmith.utils import get_env_var, get_tracer_project
from langchain_core.outputs import LLMResult
from langchain_core.tracers.langchain import LangChainTracer
@@ -130,6 +131,8 @@ class LangChainProjectNameTest(unittest.TestCase):
]
for case in cases:
get_env_var.cache_clear()
get_tracer_project.cache_clear()
with self.subTest(msg=case.test_name):
with pytest.MonkeyPatch.context() as mp:
for k, v in case.envvars.items():