-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtests_and_coverage.sh
More file actions
executable file
·41 lines (33 loc) · 1.14 KB
/
tests_and_coverage.sh
File metadata and controls
executable file
·41 lines (33 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
set -eu
my_path=$(git rev-parse --show-toplevel)
# shellcheck disable=SC1091
. "${my_path}/scripts/python-venv.sh"
# shellcheck disable=SC2154
if [ -f "${my_venv}/bin/activate" ]; then
# shellcheck disable=SC1091
. "${my_venv}/bin/activate"
if [ ! "$(which pytest)" ]; then
echo "Unable to find pytest, run setup_test.sh before this script"
exit 1
fi
else
echo "Virtualenv available, bailing out"
exit 2
fi
set +u
if [ -z "${GITHUB_ACTIONS}" ] || [ "$1" == "test_and_coverage" ] ; then
# Python tests (rerun with debug if failures)
# PYTHONPATH=$(pwd) pytest -qx tests/ --cov='.' --no-cov-on-fail --cov-report term-missing ||
PYTHONPATH=$(pwd) pytest -xrpP --log-level debug tests/
fi
if [ -z "${GITHUB_ACTIONS}" ] || [ "$1" == "linting" ] ; then
# Black first to ensure nothings roughing up ruff
echo "... black-ing ..."
black plugwise_usb/ tests/
# TODO: Skip ruff checks as there are too many for now (mainly missing docstrings)
# echo "... ruff-ing ..."
# ruff check --fix plugwise_usb/ tests/
echo "... pylint-ing ..."
pylint plugwise_usb/ tests/
fi