mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
129a929d69
- **Description:** This PR fixes test failures on Windows caused by path handling differences and unescaped special characters in regex. The failing tests are: ``` FAILED tests/unit_tests/storage/test_filesystem.py::test_yield_keys - AssertionError: assert ['key1', 'subdir\\key2'] == ['key1', 'subdir/key2'] FAILED tests/unit_tests/test_imports.py::test_importable_all - ModuleNotFoundError: No module named 'langchain_community.langchain_community\\adapters' FAILED tests/unit_tests/tools/file_management/test_utils.py::test_get_validated_relative_path_errs_on_absolute - re.error: incomplete escape \U at position 53 FAILED tests/unit_tests/tools/file_management/test_utils.py::test_get_validated_relative_path_errs_on_parent_dir - re.error: incomplete escape \U at position 69 FAILED tests/unit_tests/tools/file_management/test_utils.py::test_get_validated_relative_path_errs_for_symlink_outside_root - re.error: incomplete escape \U at position 64 ``` - **Issue:** fixes https://github.com/langchain-ai/langchain/issues/11775 (partially) - **Dependencies:** none
17 lines
503 B
Python
17 lines
503 B
Python
import glob
|
|
import importlib
|
|
from pathlib import Path
|
|
|
|
|
|
def test_importable_all() -> None:
|
|
for path in glob.glob("../community/langchain_community/*"):
|
|
relative_path = Path(path).parts[-1]
|
|
if relative_path.endswith(".typed"):
|
|
continue
|
|
module_name = relative_path.split(".")[0]
|
|
|
|
module = importlib.import_module("langchain_community." + module_name)
|
|
all_ = getattr(module, "__all__", [])
|
|
for cls_ in all_:
|
|
getattr(module, cls_)
|