#!/bin/bash

set -e

# run linting of python files
echo 'Running linting...'
ruff check backend/ tests/

echo 'Running unit tests (SQLite)...'
export Environment=test
py.test \
    --cov backend/ tests/ \
    --cov-report xml \
    --junitxml=pyunit-unit.xml \
    --ignore tests/integration \
    --ignore tests/functional

echo 'Running functional tests (MySQL)...'
TEST_DB_BACKEND=mysql py.test \
    tests/functional \
    --cov backend/ \
    --cov-append \
    --cov-report xml \
    --junitxml=pyunit-functional.xml
