1
1
import concurrent .futures
2
2
import importlib
3
3
import subprocess
4
- import warnings
5
4
from pathlib import Path
6
5
7
6
8
7
def test_importable_all () -> None :
9
- with warnings .catch_warnings ():
10
- # Suppress pydantic_v1 deprecation warnings during import testing
11
- # These warnings are expected as modules transition from pydantic v1 to v2
12
- # and are not relevant to testing importability
13
- warnings .filterwarnings (
14
- "ignore" ,
15
- message = ".*langchain_core.pydantic_v1.*" ,
16
- category = DeprecationWarning ,
17
- )
18
- for path in Path ("../core/langchain_core/" ).glob ("*" ):
19
- module_name = path .stem
20
- if not module_name .startswith ("." ) and path .suffix != ".typed" :
21
- module = importlib .import_module ("langchain_core." + module_name )
22
- all_ = getattr (module , "__all__" , [])
23
- for cls_ in all_ :
24
- getattr (module , cls_ )
8
+ for path in Path ("../core/langchain_core/" ).glob ("*" ):
9
+ module_name = path .stem
10
+ if (
11
+ not module_name .startswith ("." )
12
+ and path .suffix != ".typed"
13
+ and module_name != "pydantic_v1"
14
+ ):
15
+ module = importlib .import_module ("langchain_core." + module_name )
16
+ all_ = getattr (module , "__all__" , [])
17
+ for cls_ in all_ :
18
+ getattr (module , cls_ )
25
19
26
20
27
21
def try_to_import (module_name : str ) -> tuple [int , str ]:
28
22
"""Try to import a module via subprocess."""
29
- with warnings .catch_warnings ():
30
- # Suppress pydantic_v1 deprecation warnings during import testing
31
- # These warnings are expected as modules transition from pydantic v1 to v2
32
- # and are not relevant to testing importability
33
- warnings .filterwarnings (
34
- "ignore" ,
35
- message = ".*langchain_core.pydantic_v1.*" ,
36
- category = DeprecationWarning ,
37
- )
38
- module = importlib .import_module ("langchain_core." + module_name )
39
- all_ = getattr (module , "__all__" , [])
40
- for cls_ in all_ :
41
- getattr (module , cls_ )
23
+ module = importlib .import_module ("langchain_core." + module_name )
24
+ all_ = getattr (module , "__all__" , [])
25
+ for cls_ in all_ :
26
+ getattr (module , cls_ )
42
27
43
28
result = subprocess .run (
44
29
["python" , "-c" , f"import langchain_core.{ module_name } " ], check = True
@@ -56,7 +41,11 @@ def test_importable_all_via_subprocess() -> None:
56
41
module_names = []
57
42
for path in Path ("../core/langchain_core/" ).glob ("*" ):
58
43
module_name = path .stem
59
- if not module_name .startswith ("." ) and path .suffix != ".typed" :
44
+ if (
45
+ not module_name .startswith ("." )
46
+ and path .suffix != ".typed"
47
+ and module_name != "pydantic_v1"
48
+ ):
60
49
module_names .append (module_name )
61
50
62
51
with concurrent .futures .ThreadPoolExecutor (max_workers = 10 ) as executor :
0 commit comments