-
Notifications
You must be signed in to change notification settings - Fork 3
/
menlo.sh
executable file
·66 lines (56 loc) · 1.53 KB
/
menlo.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
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
HELP_MENLO="
setup # setup environment
help # show this message
unit # run unit tests
integration # run integration tests
"
function printHelp {
echo -e "${HELP_MENLO}"
}
function setup {
echo "Setting up environment..."
which python3 &> /dev/null || (echo "Python3 is not installed" && exit 1)
python3 --version
if [ ! -d .venv ]; then
echo "Creating virtual environment..."
python3 -m venv .venv
fi
source .venv/bin/activate
echo "Installing dependencies..."
pip install -r requirements.txt
}
if [[ $# == 0 ]]; then
printHelp
exit 0
fi
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help|help)
printHelp
exit 0
;;
setup)
setup
;;
unit)
echo "Running unit tests..."
python3 -m unittest discover -v ./tests/unit -p 'test*.py'
;;
integration)
echo "Running integration tests..."
python3 -m unittest discover -v ./tests/integration -p 'tests*.py'
;;
coverage)
setup
echo "Running coverage..."
python3 -m pytest --cov=. --cov-report=xml:tests/coverage/coverage.xml
python3 -m pytest --cov=. --cov-report=html:tests/coverage/coverage.html
;;
*)
echo "Unknown parameter: ${1}"
printHelp
exit 1
esac
shift
done