summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrique Joaquim <h.joaquim@campus.fct.unl.pt>2024-02-20 14:03:43 +0000
committerGitHub <noreply@github.com>2024-02-20 14:03:43 +0000
commit7d84690316824f1e905d1dbb52252a6cb9dff3b3 (patch)
treef76b1336f686bb844be74bb68386496f04186e97
parent9fee65ab68951c77c7f694ebabce6f4fa9181f9b (diff)
[BugFix] Fix integration tests (#6100)
* fix int tests * fix obbject int tests * fix quant tests * fix index tests * use python 3.10 instead * remove cache * end_date < start_date
-rw-r--r--.github/workflows/platform-api-integration-test.yml29
-rw-r--r--openbb_platform/core/integration/test_obbject.py9
-rw-r--r--openbb_platform/extensions/equity/integration/test_equity_api.py4
-rw-r--r--openbb_platform/extensions/equity/integration/test_equity_python.py4
-rw-r--r--openbb_platform/extensions/index/integration/test_index_python.py8
-rw-r--r--openbb_platform/extensions/quantitative/integration/test_quantitative_python.py16
6 files changed, 32 insertions, 38 deletions
diff --git a/.github/workflows/platform-api-integration-test.yml b/.github/workflows/platform-api-integration-test.yml
index 961241328e6..48076d79af4 100644
--- a/.github/workflows/platform-api-integration-test.yml
+++ b/.github/workflows/platform-api-integration-test.yml
@@ -32,26 +32,18 @@ jobs:
if: github.event_name == 'pull_request'
run: git fetch origin ${{ github.event.pull_request.head.ref }} && git checkout FETCH_HEAD
- - name: Setup Python 3.9
+ - name: Setup Python 3.10
uses: actions/setup-python@v4
with:
- python-version: "3.9"
+ python-version: "3.10"
architecture: x64
- - name: Load cached venv
- id: cached-python-environment
- uses: actions/cache@v3
- with:
- path: runner_env
- key: runner_env-${{ runner.os }}-v1-${{ hashFiles('**/poetry.lock', '**/dev_install.py') }}
-
- name: Install Dependencies
- if: steps.cached-python-environment.outputs.cache-hit != 'true'
run: |
python -m venv runner_env
source runner_env/bin/activate
pip install poetry toml
- python openbb_platform/dev_install.py -e all
+ python openbb_platform/dev_install.py -e
- name: Populate System Setting Files
run: |
@@ -87,20 +79,15 @@ jobs:
- name: Wait for 42 seconds
run: sleep 42
- - name: Run API Integration Tests
+ - name: Check installed packages
run: |
source runner_env/bin/activate
pip list
- cd openbb_platform
- pytest -m integration
- - name: Cache pip packages
- uses: actions/cache@v2
- with:
- path: ~/.cache/pip
- key: runner_env-${{ runner.os }}-v1-${{ hashFiles('**/poetry.lock', '**/dev_install.py') }}
- restore-keys: |
- ${{ runner.os }}-pip-
+ - name: Run Integration Tests
+ run: |
+ source runner_env/bin/activate
+ pytest openbb_platform -m integration
- name: Upload summary to Slack
uses: adrey/slack-file-upload-action@master
diff --git a/openbb_platform/core/integration/test_obbject.py b/openbb_platform/core/integration/test_obbject.py
index de6d63c7df5..a76d5d644fb 100644
--- a/openbb_platform/core/integration/test_obbject.py
+++ b/openbb_platform/core/integration/test_obbject.py
@@ -54,7 +54,7 @@ def test_to_numpy(obb):
"""Test obbject to numpy array."""
cpi_np = obb.economy.cpi(
- countries=["portugal", "spain", "switzerland"], frequency="annual"
+ country=["portugal", "spain", "switzerland"], frequency="annual"
).to_numpy()
assert isinstance(cpi_np, np.ndarray)
@@ -63,7 +63,7 @@ def test_to_numpy(obb):
def test_to_dict(obb):
"""Test obbject to dict."""
- fed_dict = obb.fixedincome.rate.effr(start_date="2010-01-01").to_dict()
+ fed_dict = obb.fixedincome.rate.ameribor(start_date="2020-01-01").to_dict()
assert isinstance(fed_dict, dict)
@@ -74,8 +74,9 @@ def test_to_dict(obb):
def test_to_chart(obb):
"""Test obbject to chart."""
- stocks_chart = obb.equity.price.historical("AAPL", provider="fmp").to_chart()
- assert isinstance(stocks_chart, OpenBBFigure)
+ res = obb.equity.price.historical("AAPL", provider="fmp")
+ res.charting.to_chart()
+ assert isinstance(res.chart.fig, OpenBBFigure)
@pytest.mark.skipif(
diff --git a/openbb_platform/extensions/equity/integration/test_equity_api.py b/openbb_platform/extensions/equity/integration/test_equity_api.py
index 30dddf91234..731bc57a238 100644
--- a/openbb_platform/extensions/equity/integration/test_equity_api.py
+++ b/openbb_platform/extensions/equity/integration/test_equity_api.py
@@ -918,8 +918,8 @@ def test_equity_compare_groups(params, headers):
{
"provider": "cboe",
"symbol": "AAPL",
- "start_date": "2023-01-01",
- "end_date": "2023-01-02",
+ "start_date": "2024-02-19",
+ "end_date": "2024-02-20",
"interval": "1m",
"use_cache": False,
}
diff --git a/openbb_platform/extensions/equity/integration/test_equity_python.py b/openbb_platform/extensions/equity/integration/test_equity_python.py
index d7f4127da35..d9ce9cc8ec2 100644
--- a/openbb_platform/extensions/equity/integration/test_equity_python.py
+++ b/openbb_platform/extensions/equity/integration/test_equity_python.py
@@ -863,8 +863,8 @@ def test_equity_compare_groups(params, obb):
{
"provider": "cboe",
"symbol": "AAPL",
- "start_date": "2023-01-01",
- "end_date": "2023-01-02",
+ "start_date": "2024-02-19",
+ "end_date": "2024-02-20",
"interval": "1m",
"use_cache": False,
}
diff --git a/openbb_platform/extensions/index/integration/test_index_python.py b/openbb_platform/extensions/index/integration/test_index_python.py
index fbf8e586165..49ca9aabc79 100644
--- a/openbb_platform/extensions/index/integration/test_index_python.py
+++ b/openbb_platform/extensions/index/integration/test_index_python.py
@@ -172,8 +172,8 @@ def test_index_price_historical(params, obb):
"interval": "1d",
"provider": "cboe",
"symbol": "AAVE100",
- "start_date": "2023-01-01",
- "end_date": "2023-06-06",
+ "start_date": "2024-01-01",
+ "end_date": "2024-02-06",
"use_cache": False,
"limit": None,
"sort": None,
@@ -184,8 +184,8 @@ def test_index_price_historical(params, obb):
"interval": "1min",
"provider": "fmp",
"symbol": "^DJI",
- "start_date": "2023-01-01",
- "end_date": "2023-06-06",
+ "start_date": "2024-02-01",
+ "end_date": "2024-02-03",
"timeseries": 1,
"sort": "desc",
"limit": None,
diff --git a/openbb_platform/extensions/quantitative/integration/test_quantitative_python.py b/openbb_platform/extensions/quantitative/integration/test_quantitative_python.py
index 389b8ba2b8b..f41f26613b1 100644
--- a/openbb_platform/extensions/quantitative/integration/test_quantitative_python.py
+++ b/openbb_platform/extensions/quantitative/integration/test_quantitative_python.py
@@ -181,7 +181,13 @@ def test_quantitative_unitroot_test(params, data_type, obb):
"params, data_type",
[
(
- {"data": "", "target": "close", "rfr": "", "window": "", "index": "date"},
+ {
+ "data": "",
+ "target": "close",
+ "rfr": "",
+ "window": "100",
+ "index": "date",
+ },
"equity",
),
(
@@ -189,7 +195,7 @@ def test_quantitative_unitroot_test(params, data_type, obb):
"data": "",
"target": "high",
"rfr": "0.5",
- "window": "250",
+ "window": "100",
"index": "date",
},
"crypto",
@@ -214,7 +220,7 @@ def test_quantitative_sharpe_ratio(params, data_type, obb):
"data": "",
"target": "close",
"target_return": "",
- "window": "",
+ "window": "100",
"adjusted": "",
"index": "date",
},
@@ -224,8 +230,8 @@ def test_quantitative_sharpe_ratio(params, data_type, obb):
{
"data": "",
"target": "close",
- "target_return": "0.5",
- "window": "275",
+ "target_return": "",
+ "window": "100",
"adjusted": "true",
"index": "date",
},