From 99bbcb6a319a1441b33e2d7a120470fb9fd81e89 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Mon, 19 Apr 2021 15:55:46 -0700 Subject: [PATCH] Add start and exit test --- .github/workflows/Mac.yml | 5 +++++ .github/workflows/test.yml | 11 +++++++++++ .github/workflows/windows.yml | 4 ++++ gamestonk_terminal/feature_flags.py | 3 +++ terminal.py | 4 ++++ 5 files changed, 27 insertions(+) diff --git a/.github/workflows/Mac.yml b/.github/workflows/Mac.yml index 75a8a6f540b..6459d5b055a 100644 --- a/.github/workflows/Mac.yml +++ b/.github/workflows/Mac.yml @@ -2,6 +2,7 @@ name: Mac OS X Full Clean Build with ML env: GTFF_USE_PROMPT_TOOLKIT: false GTFF_USE_ION: false + GTFF_ENABLE_QUICK_EXIT: true on: push: branches: @@ -63,3 +64,7 @@ jobs: - name: Run tests (Bash) shell: bash -l {0} run: pytest tests/ + + - name: Start Terminal and exit + shell: bash -l {0} + run: python terminal.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 17f52d31bea..5e6ead3f4d6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,7 @@ name: Tests env: GTFF_USE_PROMPT_TOOLKIT: false GTFF_USE_ION: false + GTFF_ENABLE_QUICK_EXIT: true on: [pull_request, push] jobs: linting: @@ -72,6 +73,9 @@ jobs: run: | source $VENV pytest tests/ + + - name: Start Terminal and exit + run: python terminal.py tests-python: name: Python (${{ matrix.python-version }}, ${{ matrix.os }}) needs: test @@ -120,6 +124,9 @@ jobs: run: | source $VENV pytest tests/ + + - name: Start Terminal and exit + run: python terminal.py tests-conda: name: Conda (${{ matrix.python-version }}, ${{ matrix.os }}) needs: test @@ -187,3 +194,7 @@ jobs: - name: Run tests (Bash) shell: bash -l {0} run: pytest tests/ + + - name: Start Terminal and exit + shell: bash -l {0} + run: python terminal.py diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 93723499e8c..d66f19c6e73 100755 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -2,6 +2,7 @@ name: Windows 10 Full Clean Build with ML env: GTFF_USE_PROMPT_TOOLKIT: false GTFF_USE_ION: false + GTFF_ENABLE_QUICK_EXIT: true on: push: branches: @@ -72,3 +73,6 @@ jobs: shell: bash -l {0} run: pytest tests/ + - name: Start Terminal and exit + shell: bash -l {0} + run: python terminal.py diff --git a/gamestonk_terminal/feature_flags.py b/gamestonk_terminal/feature_flags.py index 5c4910a1ab2..6cea32c0c28 100644 --- a/gamestonk_terminal/feature_flags.py +++ b/gamestonk_terminal/feature_flags.py @@ -24,3 +24,6 @@ USE_PLOT_AUTOSCALING = strtobool(os.getenv("GTFF_USE_PLOT_AUTOSCALING", "False") # Enable thoughts of the day ENABLE_THOUGHTS_DAY = strtobool(os.getenv("GTFF_ENABLE_THOUGHTS_DAY", "False")) + +# Quick exit for testing +ENABLE_QUICK_EXIT = strtobool(os.getenv("GTFF_ENABLE_QUICK_EXIT", "False")) diff --git a/terminal.py b/terminal.py index 6f637eba85e..e39ba1ff2b9 100644 --- a/terminal.py +++ b/terminal.py @@ -115,6 +115,10 @@ def main(): print_help(s_ticker, s_start, s_interval, b_is_stock_market_open()) should_print_help = False + if gtff.ENABLE_QUICK_EXIT: + print("Quick exit enabled") + break + # Get input command from stdin or user if not parsed_stdin and len(sys.argv) > 1: as_input = " ".join(sys.argv[1:])