Skip to content

Commit 37039ce

Browse files
committed
compatibility check
1 parent 4240b35 commit 37039ce

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""Test that braintrust_langchain re-exports the public API from braintrust.integrations.langchain."""
2+
3+
import importlib
4+
import warnings
5+
6+
import pytest
7+
8+
9+
def test_public_api_reexported():
10+
"""All public API symbols should be importable from braintrust_langchain."""
11+
with warnings.catch_warnings():
12+
warnings.simplefilter("ignore", DeprecationWarning)
13+
14+
from braintrust_langchain import (
15+
BraintrustCallbackHandler,
16+
BraintrustTracer,
17+
clear_global_handler,
18+
set_global_handler,
19+
)
20+
21+
assert callable(BraintrustCallbackHandler)
22+
assert callable(BraintrustTracer)
23+
assert callable(set_global_handler)
24+
assert callable(clear_global_handler)
25+
26+
27+
def test_context_module_reexported():
28+
"""braintrust_langchain.context should still work for users who imported from there directly."""
29+
with warnings.catch_warnings():
30+
warnings.simplefilter("ignore", DeprecationWarning)
31+
32+
from braintrust_langchain.context import clear_global_handler, set_global_handler
33+
34+
assert callable(set_global_handler)
35+
assert callable(clear_global_handler)
36+
37+
38+
def test_deprecation_warning():
39+
"""Importing braintrust_langchain should emit a DeprecationWarning."""
40+
import braintrust_langchain
41+
42+
with pytest.warns(DeprecationWarning, match="braintrust-langchain is deprecated"):
43+
importlib.reload(braintrust_langchain)

0 commit comments

Comments
 (0)