Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add smoke tests and increase python compatibility #69

Merged
merged 8 commits into from Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,42 @@
name: Tests
on: push
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.6.13', '3.7', '3.8']
name: Python ${{ matrix.python-version }}
steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install Poetry
uses: snok/install-poetry@v1.1.1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Run tests
env:
MPLBACKEND: Agg
run: |
source .venv/bin/activate
pytest tests/
196 changes: 150 additions & 46 deletions poetry.lock

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions pyproject.toml
Expand Up @@ -5,32 +5,32 @@ description = ""
authors = ["Didier Rodrigues Lopes"]

[tool.poetry.dependencies]
python = "~3.6.8"
fbprophet = "0.6"
pandas = "1.1.5"
iso8601 = "0.1.14"
FundamentalAnalysis = "0.2.6"
requests = "2.25.1"
alpha-vantage = "2.3.1"
finviz = "1.3.4"
bs4 = "0.0.1"
rapidfuzz = "1.1.1"
yfinance = "0.1.55"
pandas-ta = "0.2.23b0"
dataclasses = "0.8"
prettytable = "2.0.0"
psaw = "0.0.12"
praw = "7.1.4"
Quandl = "3.6.0"
flair = "0.7"
pytrends = "4.7.3"
python = "^3.6.8"
fbprophet = "^0.6"
pandas = "^1.1.5"
iso8601 = "^0.1.14"
FundamentalAnalysis = "^0.2.6"
requests = "^2.25.1"
alpha-vantage = "^2.3.1"
finviz = "^1.3.4"
bs4 = "^0.0.1"
rapidfuzz = "^1.1.1"
yfinance = "^0.1.55"
pandas-ta = "^0.2.23b0"
prettytable = "^2.0.0"
psaw = "^0.0.12"
praw = "^7.1.4"
Quandl = "^3.6.0"
flair = "^0.7"
pytrends = "^4.7.3"
TimeSeriesCrossValidation = { git = "https://github.com/DidierRLopes/TimeSeriesCrossValidation.git", branch = "master" }
pmdarima = "1.8.0"
tensorflow = "2.4.1"
matplotlib = "3.3.3"
plotly = "4.14.3"
pmdarima = "^1.8.0"
tensorflow = "^2.4.1"
matplotlib = "^3.3.3"
plotly = "^4.14.3"

[tool.poetry.dev-dependencies]
pytest = "^6.2.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
12 changes: 6 additions & 6 deletions requirements.txt
Expand Up @@ -17,7 +17,7 @@ convertdate==2.3.1; python_version >= "3.5"
cssselect==1.1.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0"
cycler==0.10.0; python_version >= "3.6"
cython==0.29.17; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6"
dataclasses==0.8; python_version >= "3.6" and python_version < "3.7"
dataclasses==0.8; python_version >= "3.6" and python_version < "3.7" and python_full_version >= "3.6.2"
decorator==4.4.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.2.0" and python_version >= "3.6"
deprecated==1.2.11; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
ephem==3.7.7.1; python_version >= "2.7" and python_version < "4"
Expand Down Expand Up @@ -55,7 +55,7 @@ langdetect==1.0.8; python_version >= "3.6"
lunarcalendar==0.0.9; python_version >= "2.7" and python_version < "4"
lxml==4.6.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
markdown==3.3.4; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.2.0" and python_version >= "3.6"
matplotlib==3.3.3; python_version >= "3.6"
matplotlib==3.3.4; python_version >= "3.6"
more-itertools==8.7.0; python_version >= "3.5"
mpld3==0.3; python_version >= "3.6"
multidict==5.1.0; python_version >= "3.6"
Expand All @@ -66,20 +66,20 @@ oauthlib==3.1.0; python_version >= "3.6" and python_full_version < "3.0.0" or py
opt-einsum==3.3.0; python_version >= "3.5"
overrides==3.0.0; python_full_version >= "3.6.1" and python_full_version < "4.0.0" and python_version >= "3.6"
packaging==20.9; python_full_version >= "3.6.0" and python_version >= "3.6"
pandas-ta==0.2.23b
pandas-ta==0.2.45b
pandas==1.1.5; python_full_version >= "3.6.1"
patsy==0.5.1; python_version >= "3.6"
pillow==8.1.0; python_version >= "3.6"
plotly==4.14.3
pmdarima==1.8.0; python_version >= "3.6"
praw==7.1.4; python_version >= "3.6" and python_version < "4.0"
prawcore==1.5.0; python_version >= "3.6" and python_version < "4.0"
praw==7.2.0; python_version >= "3.6" and python_version < "4.0"
prawcore==2.0.0; python_version >= "3.6" and python_version < "4.0"
prettytable==2.0.0; python_version >= "3.6"
protobuf==3.15.3; python_full_version >= "3.6.0" and python_version >= "3.6" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.2.0")
psaw==0.0.12; python_version >= "3"
pyasn1-modules==0.2.8; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0"
pyasn1==0.4.8; python_version >= "3.5" and python_full_version < "3.0.0" and python_version < "4" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6") or python_version >= "3.5" and python_version < "4" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6") and python_full_version >= "3.6.0"
pymeeus==0.4.2; python_version >= "3.5"
pymeeus==0.4.3; python_version >= "3.5"
pyparsing==2.4.7; python_full_version >= "3.6.0" and python_version >= "3.6"
pysocks==1.7.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pystan==2.19.1.1
Expand Down
Empty file added tests/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions tests/conftest.py
@@ -0,0 +1,2 @@
def pytest_configure(config):
config.addinivalue_line("markers", "e2e: mark as end-to-end test.")
21 changes: 21 additions & 0 deletions tests/test_gamestonk_terminal.py
@@ -0,0 +1,21 @@
from unittest.mock import patch

import pandas as pd
import pytest

from gamestonk_terminal import load

@pytest.mark.e2e
def test_load_command():

test_stock = 'TSLA'
test_start = '2020-06-04'

with patch('sys.stdout.write') as mock_out:
result = load(['-t', test_stock, '-s', test_start], '', '', '', '')

args = mock_out.call_args_list[0][0]

assert result[0] == test_stock
assert test_stock in args[0]
assert test_start in args[0]
25 changes: 25 additions & 0 deletions tests/test_prediction_techniques/test_neural_networks.py
@@ -0,0 +1,25 @@
from unittest.mock import patch

import pytest

from prediction_techniques.neural_networks import mlp
from gamestonk_terminal import load


@pytest.fixture
def stock():

def load_stock(name, start='2020-06-04'):
return load(['-t', name, '-s', start], '', '', '', '')

return load_stock


@pytest.mark.e2e
def test_mlp(stock):

with patch('sys.stdout.write') as mock_out:
tesla = stock('TSLA')
mlp([], tesla[0], tesla[2], tesla[3])

mock_out.assert_any_call('Predicted share price:')