File tree 2 files changed +6
-12
lines changed
2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -57,3 +57,9 @@ rye run pytest "$@"
57
57
58
58
echo " ==> Running Pydantic v1 tests"
59
59
rye run nox -s test-pydantic-v1 -- " $@ "
60
+
61
+ # this is a separate script instead of a pytest test as we can't rely on the
62
+ # execution order, so a tokenizer test could be executed before this check which
63
+ # invalidates everything
64
+ echo " ==> Verifying that \` tokenizers\` is lazily imported"
65
+ rye run python -c ' import anthropic, sys; assert "tokenizers" not in sys.modules; print("true")'
Original file line number Diff line number Diff line change 1
- import sys
2
1
import asyncio
3
2
import threading
4
3
import concurrent .futures
@@ -21,17 +20,6 @@ def _sync_tokenizer_test() -> None:
21
20
assert len (encoded_text .ids ) == 2 # type: ignore
22
21
23
22
24
- def test_tokenizers_is_not_imported () -> None :
25
- # note: this test relies on being executed before any of the
26
- # other tests but is a valuable test to avoid issues like this
27
- # https://github.com/anthropics/anthropic-sdk-python/issues/280
28
- assert "tokenizers" not in sys .modules
29
-
30
- _sync_tokenizer_test ()
31
-
32
- assert "tokenizers" in sys .modules
33
-
34
-
35
23
def test_threading () -> None :
36
24
failed = False
37
25
You can’t perform that action at this time.
0 commit comments