~dricottone/my-utils

ref: b29d2b4a9bcb2e3b35c41e5dbb43d6e031999a06 my-utils/unittest.sh -rwxr-xr-x 555 bytes
b29d2b4aDominic Ricottone Restarting with fresh commit history 5 years ago
                                                                                
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
#!/bin/sh

# unittest.sh
# ===========
# Usage: unittest.sh [TARGET] [OPTIONS]
#
# Run Python tests in a target directory

help_msg() {
  cat <<-EOF
	Run Python tests in a target directory
	Usage: unittest.sh [TARGET] [OPTIONS]
	Options:
	 -v, --verbose: verbose output
	 -p, --pattern: pattern to match test files
	 -h, --help: print this message
	EOF
  exit 1
}

for i in "$@"; do
  case $i in
    -h|--help) help_msg;;
  esac
done

DIR=${1:-.}
OPTS=${2}
python3 -m unittest discover -s $DIR $OPTS 2>&1 \
  | clean-unittest.awk \
  | color-unittest.sh