mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
* initial proposal for integration tests on the charting extension * int tests for charting generation * python generator * ruff * boilerplate templates * python tests * tests for the api * using body instead so data don't get redefined * unit tests for coverage * ruff * docstrings * unnecessary access to keys()
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
"""Test the integration tests."""
|
|
from openbb_core.app.charting_service import ChartingService
|
|
|
|
from extensions.tests.utils.integration_tests_testers import (
|
|
check_missing_integration_test_params,
|
|
check_missing_integration_test_providers,
|
|
get_integration_tests,
|
|
get_module_functions,
|
|
)
|
|
|
|
|
|
def run_test(test_type: str, check_function) -> None:
|
|
"""Run tests helper function."""
|
|
integration_tests = get_integration_tests(test_type=test_type)
|
|
functions = get_module_functions(integration_tests)
|
|
missing_items = check_function(functions)
|
|
|
|
assert not missing_items, "\n".join(missing_items)
|
|
|
|
|
|
def test_api_interface_integration_test_providers() -> None:
|
|
"""Test if there are any missing providers for integration tests."""
|
|
run_test("api", check_missing_integration_test_providers)
|
|
|
|
|
|
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)
|
|
|
|
|
|
def test_charting_extension_function_coverage() -> None:
|
|
"""Test if all charting extension functions are covered by integration tests."""
|
|
|
|
functions = ChartingService.get_implemented_charting_functions()
|
|
test_names = [f"test_chart_{func}" for func in functions]
|
|
integration_tests_modules = get_integration_tests(
|
|
test_type="api", filter_charting_ext=False
|
|
)
|
|
charting_module = [
|
|
module for module in integration_tests_modules if "charting" in module.__name__
|
|
]
|
|
integration_tests_functions = get_module_functions(charting_module)
|
|
|
|
missing_items = [
|
|
test for test in test_names if test not in integration_tests_functions
|
|
]
|
|
|
|
assert missing_items == [], "\n".join(missing_items)
|