This commit is contained in:
Igor Radovanovic
2023-10-04 22:16:54 +02:00
parent b06e9da721
commit 66dbb9a1df
3 changed files with 13 additions and 10 deletions

View File

@@ -20,10 +20,10 @@ def run_test(test_type: str, check_function) -> None:
@pytest.mark.skip(reason="Needs uvicorn to be launched but shouldn't be the case.")
def test_api_interface_integration_test_providers() -> None:
"""Test if there are any missing providers for integration tests."""
run_test("integration", check_missing_integration_test_providers)
run_test("api", check_missing_integration_test_providers)
@pytest.mark.skip(reason="Needs uvicorn to be launched but shouldn't be the case.")
def test_api_interface_integration_test_params() -> None:
"""Test if there are any missing params for integration tests."""
run_test("integration", check_missing_integration_test_params)
run_test("api", check_missing_integration_test_params)

View File

@@ -18,9 +18,9 @@ def run_test(test_type: str, check_function) -> None:
def test_python_interface_integration_test_providers() -> None:
"""Test if there are any missing providers for integration tests."""
run_test("unit", check_missing_integration_test_providers)
run_test("python", check_missing_integration_test_providers)
def test_python_interface_integration_test_params() -> None:
"""Test if there are any missing params for integration tests."""
run_test("unit", check_missing_integration_test_params)
run_test("python", check_missing_integration_test_params)

View File

@@ -12,13 +12,13 @@ from openbb_core.app.provider_interface import ProviderInterface
from openbb_core.app.router import CommandMap
def get_integration_tests(test_type: Literal["integration", "unit"]) -> List[Any]:
def get_integration_tests(test_type: Literal["api", "python"]) -> List[Any]:
"""Get integration tests for the OpenBB Platform."""
integration_tests: List[Any] = []
if test_type == "unit":
if test_type == "python":
file_end = "_python.py"
elif test_type == "integration":
elif test_type == "api":
file_end = "_api.py"
for extension in find_extensions():
@@ -112,9 +112,11 @@ def check_missing_params(
if isinstance(command_params, list):
for expected_param in command_params[0]:
if expected_param not in test_params.keys():
missing_params.append(
f"Missing param {expected_param} in function {function}"
)
# if return is the expected param, we can ignore
if expected_param != "return":
missing_params.append(
f"Missing param {expected_param} in function {function}"
)
return missing_params
@@ -170,6 +172,7 @@ def check_integration_tests(
missing_items = check_function(
processing_command_params, function_params, function, True
)
all_missing_items.extend(missing_items)
return all_missing_items