[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
This commit is contained in:
Henrique Joaquim
2024-02-20 14:03:43 +00:00
committed by GitHub
parent 9fee65ab68
commit 7d84690316
6 changed files with 32 additions and 38 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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