Files
OpenBB/tests/test_terminal.py
Theodore Aptekarev 3c2a8cf97f Installer fixes (#1584)
* quick econ fix

* black

* keys and feature flags

* terminal name 👀

* some more replacements

* some more replacements

* edit pyproject

* gst -> openbb

* add example portfolios back to git

* Update api from gst

* sorry.  skipping some tests

* another round of names

* another round of test edits

* Missed some .gst refs and update timezone

* water mark stuff

* Fixing Names in terminal.spec and name of GTFF_DEFAULTS to OBBFF_DEFAULTS

* Add statsmodels and linearmodels datasets to bundle

* Update openbb test scripts to exit after they're done

* Fix default export path for packaged apps

* Update packaging settings after rename

* Exclude jupyter and report from packaged apps and testing

* Fix typo

* Remove divcal from test because it freezes the terminal

* Add openbb mac icon

* Add windows icon and splashscreen

* Fix markdown linting

* Fix gov & economy failed test  (#1585)

* fix more GST to OpenBB Terminal

* Fix gov & economy fail tests

* Small changes

* Patching valuation & performance command

* Change GTFF to OBBFF

Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* Resolve no-else and inconsistent return

* Set default predict to true

* Fix multiple bugs: Add ylabels to bt menu & Fix reports bug (#1581)

* Add y labels to all bt commands

* Fix reports bug

* Update crypto market

* Update crypto market

* Remove gst folders and remaining files

Co-authored-by: didierlopes.eth <dro.lopes@campus.fct.unl.pt>

* Break CI

* Break CI again

* Fix small rsi bug (#1588)

* Add y labels to all bt commands

* Fix reports bug

* Update crypto market

* Update crypto market

* Remove gst folders and remaining files

* Add back crypto market

* Update report controller

* Remove bt view from gst

Co-authored-by: didierlopes.eth <dro.lopes@campus.fct.unl.pt>

* Clean up remainder of Gamestonk

* Fix CI back

* Force CI to install pytest

* Tests : fix test_menu

* Fix loggers linting

* Rename default OPENBB feature flags

* Rename defaults feature flag file

* Loggers : fix mypy

* OBBFF to OPENBB in terminal.spec

* Change flair to butterfly

* Force CI to create a new cache

* Force CI to create a new cache in conda tests

* Skip test

* Clear other caches

* Fix linting

Co-authored-by: james <jmaslek11@gmail.com>
Co-authored-by: Andrew <andrew.kenreich@gmail.com>
Co-authored-by: minhhoang1023 <40023817+minhhoang1023@users.noreply.github.com>
Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>
Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
2022-03-29 20:10:00 +03:00

61 lines
1.8 KiB
Python

from contextlib import contextmanager
import pytest
import terminal
@pytest.mark.skip
@pytest.mark.block_network
@pytest.mark.vcr(record_mode="none")
@pytest.mark.record_stdout
def test_terminal_quick_exit(mocker, monkeypatch):
monkeypatch.setattr(terminal.obbff, "ENABLE_QUICK_EXIT", True)
monkeypatch.setattr(terminal.obbff, "USE_ION", False)
monkeypatch.setattr(terminal.obbff, "USE_PROMPT_TOOLKIT", True)
mocker.patch("sys.stdin")
terminal.terminal()
@pytest.mark.skip
@pytest.mark.vcr(record_mode="none")
@pytest.mark.record_stdout
def test_terminal_quit(mocker, monkeypatch):
monkeypatch.setattr(terminal.obbff, "ENABLE_QUICK_EXIT", False)
monkeypatch.setattr(terminal.obbff, "USE_ION", False)
monkeypatch.setattr(terminal.obbff, "USE_PROMPT_TOOLKIT", True)
mocker.patch("sys.stdin")
mocker.patch("builtins.input", return_value="e")
mocker.patch("terminal.session")
mocker.patch("terminal.session.prompt", return_value="e")
mocker.patch("terminal.print_goodbye")
spy_print_goodbye = mocker.spy(terminal, "print_goodbye")
terminal.terminal()
spy_print_goodbye.assert_called_once()
@contextmanager
def no_suppress():
yield
@pytest.mark.skip
@pytest.mark.vcr(record_mode="none")
@pytest.mark.record_stdout
@pytest.mark.parametrize(
"debug, test, verbose, filtert, path",
[
(True, False, False, None, None),
(False, False, False, None, ["scripts/test_alt_covid.gst"]),
(False, True, False, "alt_covid", ["scripts/"]),
(False, True, True, "alt_covid", ["scripts/"]),
],
)
def test_menu(mocker, debug, test, filtert, path, verbose):
mocker.patch(target="terminal.terminal")
mocker.patch(target="terminal.suppress_stdout", side_effect=no_suppress)
terminal.main(debug, test, filtert, path, verbose)