This commit is contained in:
Igor Radovanovic
2023-10-06 23:10:46 +02:00
parent 4744b5816b
commit ea4f4a7e2d
5 changed files with 21 additions and 12 deletions

View File

@@ -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()

View File

@@ -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,

View File

@@ -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)