summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormontezdesousa <79287829+montezdesousa@users.noreply.github.com>2024-03-05 20:27:58 +0000
committerGitHub <noreply@github.com>2024-03-05 20:27:58 +0000
commitb768bc08d74d6c097c054090163d3552ca501e60 (patch)
tree552f3357f9cbdebd1fcfa0bbcff563418d60eae0
parent6efab3fd15983563a36282a2e90caa031b7b5021 (diff)
[Bug fix] - Run charting tests again (#6167)
* run tests again * forgot these 2
-rw-r--r--openbb_platform/core/tests/app/model/charts/test_chart.py8
-rw-r--r--openbb_platform/extensions/tests/conftest.py8
-rw-r--r--openbb_platform/extensions/tests/test_integration_tests_api.py2
-rw-r--r--openbb_platform/extensions/tests/test_integration_tests_python.py2
-rw-r--r--openbb_platform/extensions/tests/utils/helpers.py9
-rw-r--r--openbb_platform/obbject_extensions/charting/integration/test_charting_api.py22
-rw-r--r--openbb_platform/obbject_extensions/charting/integration/test_charting_python.py22
7 files changed, 40 insertions, 33 deletions
diff --git a/openbb_platform/core/tests/app/model/charts/test_chart.py b/openbb_platform/core/tests/app/model/charts/test_chart.py
index 3225be2ffae..0278a3625b9 100644
--- a/openbb_platform/core/tests/app/model/charts/test_chart.py
+++ b/openbb_platform/core/tests/app/model/charts/test_chart.py
@@ -2,7 +2,7 @@ import pytest
from openbb_core.app.model.charts.chart import Chart, ChartFormat
-def test_chart_default_values():
+def test_charting_default_values():
# Arrange & Act
chart = Chart()
@@ -11,7 +11,7 @@ def test_chart_default_values():
assert chart.format == ChartFormat.plotly
-def test_chart_custom_values():
+def test_charting_custom_values():
# Arrange
content = {"data": [1, 2, 3]}
chart_format = ChartFormat.plotly
@@ -24,7 +24,7 @@ def test_chart_custom_values():
assert chart.format == chart_format
-def test_chart_assignment_validation():
+def test_charting_assignment_validation():
# Arrange
chart = Chart()
@@ -33,7 +33,7 @@ def test_chart_assignment_validation():
chart.invalid_field = "Invalid Value"
-def test_chart_config_validation():
+def test_charting_config_validation():
# Arrange
content = {"data": [1, 2, 3]}
chart_format = ChartFormat.plotly
diff --git a/openbb_platform/extensions/tests/conftest.py b/openbb_platform/extensions/tests/conftest.py
index 45f1b849572..bf9c9b65b10 100644
--- a/openbb_platform/extensions/tests/conftest.py
+++ b/openbb_platform/extensions/tests/conftest.py
@@ -16,12 +16,14 @@ commands = list(cm.map.keys())
def parametrize(argnames: str, argvalues: List[Dict], **kwargs):
"""Custom parametrize decorator that filters test cases based on the environment."""
- extensions, providers = list_openbb_extensions()
+ routers, providers, obbject_ext = list_openbb_extensions()
def decorator(function):
"""Patch the pytest.mark.parametrize decorator."""
filtered_argvalues: List[Dict] = []
- extension_name = function.__name__.split("_")[1]
+ name = function.__name__.split("_")[1]
+ # This is a patch to handle the charting extension name
+ extension_name = "openbb_" + name if name == "charting" else name
function_name = "/" + "/".join(function.__name__.split("_")[1:])
# this handles edge cases where the function name has an underscore
function_name_v2 = (
@@ -34,7 +36,7 @@ def parametrize(argnames: str, argvalues: List[Dict], **kwargs):
+ "_"
+ function_name.rsplit("/", 1)[1].replace("/", "_")
)
- if extension_name in extensions:
+ if extension_name in routers | obbject_ext:
for args in argvalues:
if "provider" in args and args["provider"] in providers:
filtered_argvalues.append(args)
diff --git a/openbb_platform/extensions/tests/test_integration_tests_api.py b/openbb_platform/extensions/tests/test_integration_tests_api.py
index 70f3d0823ad..22279113387 100644
--- a/openbb_platform/extensions/tests/test_integration_tests_api.py
+++ b/openbb_platform/extensions/tests/test_integration_tests_api.py
@@ -43,7 +43,7 @@ def test_charting_extension_function_coverage() -> None:
"""Test if all charting extension functions are covered by integration tests."""
functions = Charting.functions()
- test_names = [f"test_chart_{func}" for func in functions]
+ test_names = [f"test_charting_{func}" for func in functions]
integration_tests_modules = get_integration_tests(
test_type="api", filter_charting_ext=False
)
diff --git a/openbb_platform/extensions/tests/test_integration_tests_python.py b/openbb_platform/extensions/tests/test_integration_tests_python.py
index 8940db9821e..abed14fa301 100644
--- a/openbb_platform/extensions/tests/test_integration_tests_python.py
+++ b/openbb_platform/extensions/tests/test_integration_tests_python.py
@@ -43,7 +43,7 @@ def test_charting_extension_function_coverage() -> None:
"""Test if all charting extension functions are covered by integration tests."""
functions = Charting.functions()
- test_names = [f"test_chart_{func}" for func in functions]
+ test_names = [f"test_charting_{func}" for func in functions]
integration_tests_modules = get_integration_tests(
test_type="python", filter_charting_ext=False
)
diff --git a/openbb_platform/extensions/tests/utils/helpers.py b/openbb_platform/extensions/tests/utils/helpers.py
index bff32072dba..264bdb4958d 100644
--- a/openbb_platform/extensions/tests/utils/helpers.py
+++ b/openbb_platform/extensions/tests/utils/helpers.py
@@ -72,7 +72,7 @@ def check_docstring_examples() -> List[str]:
return errors
-def list_openbb_extensions() -> Tuple[Set[str], Set[str]]:
+def list_openbb_extensions() -> Tuple[Set[str], Set[str], Set[str]]:
"""
Lists installed openbb extensions and providers.
@@ -81,10 +81,12 @@ def list_openbb_extensions() -> Tuple[Set[str], Set[str]]:
Tuple[Set[str], Set[str]]
First element: set of installed core extensions.
Second element: set of installed provider extensions.
+ Third element: set of installed obbject extensions.
"""
core_extensions = set()
provider_extensions = set()
+ obbject_extensions = set()
entry_points_dict = entry_points()
for entry_point in entry_points_dict["openbb_core_extension"]:
@@ -93,4 +95,7 @@ def list_openbb_extensions() -> Tuple[Set[str], Set[str]]:
for entry_point in entry_points_dict["openbb_provider_extension"]:
provider_extensions.add(f"{entry_point.name}")
- return core_extensions, provider_extensions
+ for entry_point in entry_points_dict["openbb_obbject_extension"]:
+ obbject_extensions.add(f"{entry_point.name}")
+
+ return core_extensions, provider_extensions, obbject_extensions
diff --git a/openbb_platform/obbject_extensions/charting/integration/test_charting_api.py b/openbb_platform/obbject_extensions/charting/integration/test_charting_api.py
index 15ea8decc1c..d5df11fdc63 100644
--- a/openbb_platform/obbject_extensions/charting/integration/test_charting_api.py
+++ b/openbb_platform/obbject_extensions/charting/integration/test_charting_api.py
@@ -57,7 +57,7 @@ def get_equity_data():
],
)
@pytest.mark.integration
-def test_chart_equity_price_historical(params, headers):
+def test_charting_equity_price_historical(params, headers):
"""Test chart equity load."""
params = {p: v for p, v in params.items() if v}
@@ -80,7 +80,7 @@ def test_chart_equity_price_historical(params, headers):
[({"symbol": "AAPL", "limit": 100, "chart": True})],
)
@pytest.mark.integration
-def test_chart_equity_fundamental_multiples(params, headers):
+def test_charting_equity_fundamental_multiples(params, headers):
"""Test chart equity multiples."""
params = {p: v for p, v in params.items() if v}
@@ -114,7 +114,7 @@ def test_chart_equity_fundamental_multiples(params, headers):
],
)
@pytest.mark.integration
-def test_chart_technical_adx(params, headers):
+def test_charting_technical_adx(params, headers):
"""Test chart ta adx."""
params = {p: v for p, v in params.items() if v}
body = json.dumps(get_equity_data())
@@ -138,7 +138,7 @@ def test_chart_technical_adx(params, headers):
[({"data": "", "index": "date", "length": "30", "scalar": "110", "chart": True})],
)
@pytest.mark.integration
-def test_chart_technical_aroon(params, headers):
+def test_charting_technical_aroon(params, headers):
"""Test chart ta aroon."""
params = {p: v for p, v in params.items() if v}
body = json.dumps(get_equity_data())
@@ -173,7 +173,7 @@ def test_chart_technical_aroon(params, headers):
],
)
@pytest.mark.integration
-def test_chart_technical_ema(params, headers):
+def test_charting_technical_ema(params, headers):
"""Test chart ta ema."""
params = {p: v for p, v in params.items() if v}
body = json.dumps(get_equity_data())
@@ -208,7 +208,7 @@ def test_chart_technical_ema(params, headers):
],
)
@pytest.mark.integration
-def test_chart_technical_hma(params, headers):
+def test_charting_technical_hma(params, headers):
"""Test chart ta hma."""
params = {p: v for p, v in params.items() if v}
body = json.dumps(get_equity_data())
@@ -244,7 +244,7 @@ def test_chart_technical_hma(params, headers):
],
)
@pytest.mark.integration
-def test_chart_technical_macd(params, headers):
+def test_charting_technical_macd(params, headers):
"""Test chart ta macd."""
params = {p: v for p, v in params.items() if v}
body = json.dumps(get_equity_data())
@@ -280,7 +280,7 @@ def test_chart_technical_macd(params, headers):
],
)
@pytest.mark.integration
-def test_chart_technical_rsi(params, headers):
+def test_charting_technical_rsi(params, headers):
"""Test chart ta rsi."""
params = {p: v for p, v in params.items() if v}
body = json.dumps(get_equity_data())
@@ -315,7 +315,7 @@ def test_chart_technical_rsi(params, headers):
],
)
@pytest.mark.integration
-def test_chart_technical_sma(params, headers):
+def test_charting_technical_sma(params, headers):
"""Test chart ta sma."""
params = {p: v for p, v in params.items() if v}
body = json.dumps(get_equity_data())
@@ -350,7 +350,7 @@ def test_chart_technical_sma(params, headers):
],
)
@pytest.mark.integration
-def test_chart_technical_wma(params, headers):
+def test_charting_technical_wma(params, headers):
"""Test chart ta wma."""
params = {p: v for p, v in params.items() if v}
body = json.dumps(get_equity_data())
@@ -385,7 +385,7 @@ def test_chart_technical_wma(params, headers):
],
)
@pytest.mark.integration
-def test_chart_technical_zlma(params, headers):
+def test_charting_technical_zlma(params, headers):
"""Test chart ta zlma."""
params = {p: v for p, v in params.items() if v}
body = json.dumps(get_equity_data())
diff --git a/openbb_platform/obbject_extensions/charting/integration/test_charting_python.py b/openbb_platform/obbject_extensions/charting/integration/test_charting_python.py
index 90bc88151b2..68d4e6a18b2 100644
--- a/openbb_platform/obbject_extensions/charting/integration/test_charting_python.py
+++ b/openbb_platform/obbject_extensions/charting/integration/test_charting_python.py
@@ -50,7 +50,7 @@ def get_equity_data():
],
)
@pytest.mark.integration
-def test_chart_equity_price_historical(params, obb):
+def test_charting_equity_price_historical(params, obb):
"""Test chart equity price historical."""
result = obb.equity.price.historical(**params)
assert result
@@ -67,7 +67,7 @@ def test_chart_equity_price_historical(params, obb):
],
)
@pytest.mark.integration
-def test_chart_equity_fundamental_multiples(params, obb):
+def test_charting_equity_fundamental_multiples(params, obb):
"""Test chart equity multiples."""
params = {p: v for p, v in params.items() if v}
@@ -95,7 +95,7 @@ def test_chart_equity_fundamental_multiples(params, obb):
],
)
@pytest.mark.integration
-def test_chart_technical_adx(params, obb):
+def test_charting_technical_adx(params, obb):
"""Test chart ta adx."""
params = {p: v for p, v in params.items() if v}
@@ -124,7 +124,7 @@ def test_chart_technical_adx(params, obb):
],
)
@pytest.mark.integration
-def test_chart_technical_aroon(params, obb):
+def test_charting_technical_aroon(params, obb):
"""Test chart ta aroon."""
params = {p: v for p, v in params.items() if v}
@@ -154,7 +154,7 @@ def test_chart_technical_aroon(params, obb):
],
)
@pytest.mark.integration
-def test_chart_technical_ema(params, obb):
+def test_charting_technical_ema(params, obb):
"""Test chart ta ema."""
params = {p: v for p, v in params.items() if v}
@@ -184,7 +184,7 @@ def test_chart_technical_ema(params, obb):
],
)
@pytest.mark.integration
-def test_chart_technical_hma(params, obb):
+def test_charting_technical_hma(params, obb):
"""Test chart ta hma."""
params = {p: v for p, v in params.items() if v}
@@ -215,7 +215,7 @@ def test_chart_technical_hma(params, obb):
],
)
@pytest.mark.integration
-def test_chart_technical_macd(params, obb):
+def test_charting_technical_macd(params, obb):
"""Test chart ta macd."""
params = {p: v for p, v in params.items() if v}
@@ -246,7 +246,7 @@ def test_chart_technical_macd(params, obb):
],
)
@pytest.mark.integration
-def test_chart_technical_rsi(params, obb):
+def test_charting_technical_rsi(params, obb):
"""Test chart ta rsi."""
params = {p: v for p, v in params.items() if v}
@@ -276,7 +276,7 @@ def test_chart_technical_rsi(params, obb):
],
)
@pytest.mark.integration
-def test_chart_technical_sma(params, obb):
+def test_charting_technical_sma(params, obb):
"""Test chart ta sma."""
params = {p: v for p, v in params.items() if v}
@@ -306,7 +306,7 @@ def test_chart_technical_sma(params, obb):
],
)
@pytest.mark.integration
-def test_chart_technical_wma(params, obb):
+def test_charting_technical_wma(params, obb):
"""Test chart ta wma."""
params = {p: v for p, v in params.items() if v}
@@ -336,7 +336,7 @@ def test_chart_technical_wma(params, obb):
],
)
@pytest.mark.integration
-def test_chart_technical_zlma(params, obb):
+def test_charting_technical_zlma(params, obb):
"""Test chart ta zlma."""
params = {p: v for p, v in params.items() if v}