-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathppt
executable file
·56 lines (45 loc) · 1.16 KB
/
ppt
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
#!/bin/bash -ue
# Runs pytest tests locally.
usage() {
(
echo "usage: ${0##*/} [-h|--help] args"
echo "Runs pytest tests locally."
echo
echo "options:"
(
echo " -h, --help@ show usage help"
) | column -ts@
) >&2
exit 1
}
if echo "$*" | grep -Eq -- '--help\b|-h\b'; then
usage
fi
USE_PIPENV=0
if [[ -n "$(command -v pipenv)" ]]; then
USE_PIPENV=1
fi
USE_PYTEST=0
if [[ -n "$(command -v pytest)" ]]; then
USE_PYTEST=1
fi
USE_UNITTEST=0
if [[ $USE_PIPENV == "0" && $USE_PYTEST == "0" ]]; then
USE_UNITTEST=1
fi
# shellcheck source=.shell_control
# shellcheck disable=SC1091
source "$HOME/.shell_control" || echo "$(tput bold)error: ~/.shell_control not installed!$(tput sgr0)" >&2
export PIPENV_VERBOSITY="-1"
export PIPENV_QUIET="1"
export LOG_LEVEL="WARNING"
COMMAND=""
if [[ $USE_UNITTEST == "1" ]]; then
COMMAND="python -m unittest $*"
elif [[ $USE_PYTEST == "1" ]]; then
COMMAND="pytest --reuse-db --disable-pytest-warnings -vv --no-header --show-capture=stdout --capture=tee-sys $*"
fi
if [[ $USE_PIPENV == "1" ]]; then
COMMAND="pipenv run $COMMAND"
fi
run "$COMMAND"