#!/bin/bash

set -e

# run linting of python and yaml files
echo 'Running linting...'
flake8 moneyhub/ tests/ scripts/*.py dev.py application.py

# set flags for pytest-cov
COVERAGE_ARGS='--cov-report=term --cov=moneyhub --cov-report xml:build/coverage.xml --junitxml=build/pyunit.xml --cov-config=setup.cfg'

# run pytest with args set
echo 'Running tests...'
PYTHONDONTWRITEBYTECODE=1 COVERAGE_FILE=build/.coverage python -m pytest -v tests/unit/ -p no:cacheprovider $COVERAGE_ARGS

echo 'Done!'
