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 #!/usr/bin/env bash
echo "::group::Install Python apps" echo "::group::Install Python apps"
pip3 install nose mock
for app in $(ls python_apps); do for app in $(ls python_apps); do
if [[ -f "python_apps/$app/requirements-dev.txt" ]]; then if [[ -f "python_apps/$app/requirements-dev.txt" ]]; then
pip3 install -r "python_apps/$app/requirements-dev.txt" pip3 install -r "python_apps/$app/requirements-dev.txt"
fi fi
pip3 install -e python_apps/$app pip3 install -e "python_apps/$app"
done done
echo "::endgroup::" echo "::endgroup::"

View File

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