File tree Expand file tree Collapse file tree 2 files changed +15
-19
lines changed
Expand file tree Collapse file tree 2 files changed +15
-19
lines changed Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515
16- import glob
17- import importlib
18- import os
1916from collections import defaultdict
2017from typing import Dict
2118
2623from rai .config .models import BEDROCK_CLAUDE_HAIKU , OPENAI_MINI
2724
2825
29- @pytest .fixture
30- def rai_python_modules ():
31- packages = glob .glob ("src/rai*" ) + glob .glob ("src/*/rai*" )
32- package_names = [os .path .basename (p ) for p in packages ]
33- ros2_python_packages = []
34- for package_path , package_name in zip (packages , package_names ):
35- if os .path .isdir (f"{ package_path } /{ package_name } " ):
36- ros2_python_packages .append (package_name )
37-
38- return [importlib .import_module (p ) for p in ros2_python_packages ]
39-
40-
4126@pytest .fixture
4227def chat_openai_multimodal ():
4328 from langchain_openai .chat_models import ChatOpenAI
Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515
16+ import glob
1617import importlib
1718import os
1819import pathlib
2122import pytest
2223
2324
24- def test_can_import_all_modules_pathlib (rai_python_modules ) -> None :
25+ def rai_python_modules ():
26+ packages = glob .glob ("src/rai*" ) + glob .glob ("src/*/rai*" )
27+ package_names = [os .path .basename (p ) for p in packages ]
28+ ros2_python_packages = []
29+ for package_path , package_name in zip (packages , package_names ):
30+ if os .path .isdir (f"{ package_path } /{ package_name } " ):
31+ ros2_python_packages .append (package_name )
32+
33+ return [importlib .import_module (p ) for p in ros2_python_packages ]
34+
35+
36+ @pytest .mark .parametrize ("module" , rai_python_modules ())
37+ def test_can_import_all_modules_pathlib (module : ModuleType ) -> None :
2538
2639 def import_submodules (package : ModuleType ) -> None :
2740
@@ -51,6 +64,4 @@ def import_submodules(package: ModuleType) -> None:
5164 print ("FAIL" )
5265 pytest .fail (f"Failed to import { full_name } : { str (e )} " )
5366
54- for module in rai_python_modules :
55- print (f"Checking { module } " )
56- import_submodules (module )
67+ import_submodules (module )
You can’t perform that action at this time.
0 commit comments