mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-06-06 20:56:27 +08:00
* stash some changes * add more robust testing * mypy * point PR at V5 * introduce spec file * codespell * test fix * fix workflow environment setup * fix workflow environment setup * fix workflow environment setup * add pyyaml to dependencies * split lint jobs * fix workflow environment setup * fix workflow environment setup * workflow env setup * workflow env setup * clean up code comments * add auth hook entrypoints * codespell * add codegen feature * codespell * move _unpack into dispatchers for consistency with codegen packages * surface nested models in the response * fix missing coverage in CI * socrata updates * test fix * detect plotly output * add --include and --exclude flags from generate-extension command * cap test matrix at python 3.14 * no useless comments * platform controller command description split * merge URL overloads from path params * exclude none and unset from model dump --------- Co-authored-by: deeleeramone <> Co-authored-by: Copilot <copilot@github.com>
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
"""Integration tests for CLI commands.
|
|
|
|
The default mode is non-TTY: ``main()`` parses argv, dispatches one command,
|
|
emits a JSON line, and exits. These tests cover that one-shot path against
|
|
real provider commands — they require API credentials and are gated by the
|
|
``integration`` marker so they don't run in default CI sweeps.
|
|
"""
|
|
|
|
import shlex
|
|
|
|
import pytest
|
|
|
|
from openbb_cli.cli import main
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"command",
|
|
[
|
|
"equity.price.historical --symbol aapl --provider fmp",
|
|
"equity.price.historical --symbol msft --provider yfinance",
|
|
"equity.price.historical --symbol goog --provider polygon",
|
|
"crypto.price.historical --symbol btc --provider fmp",
|
|
"currency.price.historical --symbol eur --provider fmp",
|
|
"derivatives.futures.historical --symbol cl --provider fmp",
|
|
"etf.price.historical --symbol spy --provider fmp",
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_launch_one_shot(capsys, command):
|
|
"""``main(argv)`` dispatches the command and exits without raising.
|
|
|
|
The exit code may be non-zero (e.g. missing API key) — we only assert
|
|
that the entry point returns cleanly and emits a JSON line on stdout.
|
|
"""
|
|
rc = main(shlex.split(command))
|
|
captured = capsys.readouterr()
|
|
assert isinstance(rc, int)
|
|
assert captured.out, "expected a JSON response line on stdout"
|