generated from wayfair-incubator/oss-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_tests.sh
executable file
·53 lines (43 loc) · 1014 Bytes
/
run_tests.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
set -eo pipefail
BLACK_ACTION="--check"
ISORT_ACTION="--check-only"
function usage
{
echo "usage: run_tests.sh [--format-code]"
echo ""
echo " --format-code : Format the code instead of checking formatting."
exit 1
}
while [[ $# -gt 0 ]]; do
arg="$1"
case $arg in
--format-code)
BLACK_ACTION="--quiet"
ISORT_ACTION="--profile black --atomic"
;;
-h|--help)
usage
;;
"")
# ignore
;;
*)
echo "Unexpected argument: ${arg}"
usage
;;
esac
shift
done
# only generate html locally
pytest --cov plugin_scripts/ tests --cov-report html
echo "Running MyPy..."
mypy plugin_scripts tests
echo "Running iSort..."
isort ${ISORT_ACTION} plugin_scripts tests
echo "Running black..."
black ${BLACK_ACTION} plugin_scripts tests
echo "Running flake8..."
flake8 plugin_scripts tests
echo "Running bandit..."
bandit --ini .bandit --quiet -r plugin_scripts tests