diff --git a/openbb_platform/extensions/tests/__init__.py b/openbb_platform/extensions/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/openbb_platform/extensions/tests/test_integration_tests_api.py b/openbb_platform/extensions/tests/test_integration_tests_api.py index 516bad4e099..a9adaec9c11 100644 --- a/openbb_platform/extensions/tests/test_integration_tests_api.py +++ b/openbb_platform/extensions/tests/test_integration_tests_api.py @@ -1,6 +1,6 @@ """Test the integration tests.""" import pytest -from .openbb_platform.extensions.tests.utils.integration_tests_testers import ( +from extensions.tests.utils.integration_tests_testers import ( check_missing_integration_test_params, check_missing_integration_test_providers, get_integration_tests, @@ -28,3 +28,6 @@ def test_api_interface_integration_test_providers() -> None: def test_api_interface_integration_test_params() -> None: """Test if there are any missing params for integration tests.""" run_test("api", check_missing_integration_test_params) + + +test_api_interface_integration_test_params() diff --git a/openbb_platform/extensions/tests/test_integration_tests_python.py b/openbb_platform/extensions/tests/test_integration_tests_python.py index 0098a61a963..1303b8ed62b 100644 --- a/openbb_platform/extensions/tests/test_integration_tests_python.py +++ b/openbb_platform/extensions/tests/test_integration_tests_python.py @@ -1,6 +1,6 @@ """Test the integration tests.""" import pytest -from .openbb_platform.extensions.tests.utils.integration_tests_testers import ( +from extensions.tests.utils.integration_tests_testers import ( check_missing_integration_test_params, check_missing_integration_test_providers, get_integration_tests, diff --git a/openbb_platform/extensions/tests/utils/__init__.py b/openbb_platform/extensions/tests/utils/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/openbb_platform/extensions/tests/utils/integration_tests_testers.py b/openbb_platform/extensions/tests/utils/integration_tests_testers.py index 3de971d777a..38b560bc71d 100644 --- a/openbb_platform/extensions/tests/utils/integration_tests_testers.py +++ b/openbb_platform/extensions/tests/utils/integration_tests_testers.py @@ -2,7 +2,7 @@ import importlib.util import inspect import os -from typing import Any, Callable, Dict, List, Literal, Union, get_type_hints +from typing import Any, Callable, Dict, List, Literal, Tuple, Union, get_type_hints from extensions.tests.utils.integration_tests_generator import ( find_extensions, @@ -49,7 +49,7 @@ def get_module_functions(module_list: List[Any]) -> Dict[str, Any]: def check_missing_providers( - command_params: Union[Dict[str, Dict[str, dict]], List[Dict[str, str]]], + command_params: Union[Dict[str, Dict[str, dict]], List[Tuple[Dict[str, str], str]]], function_params: List[dict], function, processing: bool = False, @@ -82,7 +82,7 @@ def check_missing_providers( def check_missing_params( - command_params: Union[Dict[str, Dict[str, dict]], List[Dict[str, str]]], + command_params: Union[Dict[str, Dict[str, dict]], List[Tuple[Dict[str, str], str]]], function_params: List[dict], function, processing: bool = False, @@ -110,11 +110,17 @@ def check_missing_params( else: for test_params in function_params: if isinstance(command_params, list): - for expected_param in command_params[0]: - if ( - expected_param not in test_params.keys() - and expected_param != "return" - ): + try: + iter_commands_params = command_params[0][0] + except KeyError: + iter_commands_params = command_params[0] # type: ignore + + for expected_param in iter_commands_params: + try: + used_params = test_params[0].keys() + except KeyError: + used_params = test_params.keys() + if expected_param not in used_params and expected_param != "return": missing_params.append( f"Missing param {expected_param} in function {function}" ) @@ -125,7 +131,7 @@ def check_integration_tests( functions: Dict[str, Any], check_function: Callable[ [ - Union[Dict[str, Dict[str, dict]], List[Dict[str, str]]], + Union[Dict[str, Dict[str, dict]], List[Tuple[Dict[str, str], str]]], List[dict], str, bool, @@ -171,7 +177,7 @@ def check_integration_tests( function_params = functions[function].pytestmark[1].args[1] missing_items = check_function( - processing_command_params, function_params, function, True + processing_command_params, function_params, function, True # type: ignore ) all_missing_items.extend(missing_items)