forked from befelix/Safe-RL-Benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_code.sh
More file actions
executable file
·44 lines (34 loc) · 1.34 KB
/
Copy pathtest_code.sh
File metadata and controls
executable file
·44 lines (34 loc) · 1.34 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
42
43
44
#!/usr/bin/env bash
module="SafeRLBench"
get_script_dir () {
SOURCE="${BASH_SOURCE[0]}"
# While $SOURCE is a symlink, resolve it
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$( readlink "$SOURCE" )"
# If $SOURCE was a relative symlink (so no "/" as prefix, need to resolve it relative to the symlink base directory
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
echo "$DIR"
}
# tensorflow environment variable
export TF_CPP_MIN_LOG_LEVEL='3'
# Change to script root
cd $(get_script_dir)
GREEN='\033[0;32m'
NC='\033[0m'
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
# Run style tests
echo -e "${GREEN}${BOLD}Running style tests:${NC}"
flake8 $module --exclude test*.py,__init__.py,_quadrocopter --show-source
# Ignore import errors for __init__ and tests
flake8 $module --filename=__init__.py,test*.py --ignore=F --show-source
echo -e "${GREEN}${BOLD}Testing docstring conventions:${NC}"
# Test docstring conventions
pydocstyle $module --match='(?!__init__).*\.py' 2>&1 | grep -v "WARNING: __all__"
echo -e "${GREEN}${BOLD}Running unit tests in current environment.${NC}"
nosetests -v --with-doctest --with-coverage --cover-erase --cover-package=$module $module 2>&1 | grep -v "^Level "
# Export html
coverage html