Update CI to run pytest

This commit is contained in:
jo 2021-06-07 23:58:16 +02:00
parent bec298d63f
commit ed3d527c09
4 changed files with 24 additions and 13 deletions

View File

@ -1,12 +1,10 @@
#!/usr/bin/env bash
echo "::group::Install Python apps"
pip3 install nose mock
for app in $(ls python_apps); do
if [[ -f "python_apps/$app/requirements-dev.txt" ]]; then
pip3 install -r "python_apps/$app/requirements-dev.txt"
fi
pip3 install -e python_apps/$app
pip3 install -e "python_apps/$app"
done
echo "::endgroup::"

View File

@ -1,24 +1,21 @@
#!/usr/bin/env bash
failed='f'
# Starting at repo root
failed="false"
echo "::group::Airtime Analyzer"
pushd python_apps/airtime_analyzer
if ! nosetests . -x; then
failed='t'
if ! make -C python_apps/airtime_analyzer test; then
failed="true"
fi
popd
echo "::endgroup::"
echo "::group::API Client"
if ! make -C python_apps/api_clients test; then
failed='t'
failed="true"
fi
echo "::endgroup::"
if [[ "$failed" = "t" ]]; then
echo "Python tests failed"
exit 1
if [[ "$failed" = "true" ]]; then
echo "Python tests failed"
exit 1
fi
echo "Python tests passed!"

View File

@ -0,0 +1,16 @@
.PHONY: lint test
SHELL := bash
CPU_CORES := $(shell nproc)
MODULE_APP := airtime_analyzer
MODULE_TESTS := tests
lint:
pylint ${MODULE_APP}
pylint ${MODULE_TESTS}
test:
pytest -n ${CPU_CORES} --color=yes -v --cov=${MODULE_APP} ${MODULE_TESTS}
all: lint test