-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexec-tests.sh
executable file
·85 lines (62 loc) · 2.14 KB
/
exec-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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bash
# Source the common helpers script.
source scripts/common.bash
# Check if we're in a virtual environment
pip_opt_user=""
if [ -z ${VIRTUAL_ENV} ]; then
# if not in virtual environment
pip_opt_user="--user"
fi
execute_command_checked "./exec-reqs-install.sh"
# add -s for verbose output
printf "${yellow}"
print_banner "Python 3"
printf "${normal}\n"
find . -name "__pycache__" -exec rm -rf {} \; >& /dev/null
find . -name "*.py?" -exec rm {} \; >& /dev/null
#if [ -e tests ]; then
# rm -rf tests
#fi
options=(
--cov=setenvironment
--cov-report=term
--cov-report=term-missing
--cov-report=html
--cov-report=xml
--cov-config=.coveragerc
)
python3 -m pytest ${options[@]}
err=$?
# Install the package
execute_command_checked "python3 -m pip wheel --no-deps -w dist . >& _test-build-dist.log"
execute_command_checked "python3 -m pip install ${pip_opt_user} . >& _test-install.log"
# Check the examples
if [ -d examples ]; then
execute_command_checked "pushd examples"
execute_command_checked "python3 example-01.py >& _test-example-01.log"
#execute_command_checked "python3 example-02.py >& _test-example-02.log"
#execute_command_checked "python3 example-03.py >& _test-example-03.log"
execute_command_checked "popd"
fi
# Clean up installed package
execute_command_checked "python3 -m pip uninstall -y setenvironment >& _test-uninstall.log"
# Clean up generated bytecode
if [ $err -eq 0 ]; then
execute_command "find . -name '__pycache__' -exec rm -rf {} \; > /dev/null 2>&1"
execute_command "find . -name '*.py?' -exec rm {} \; > /dev/null 2>&1"
execute_command "find . -depth 2 -name '_example-*.ini' -exec rm {} \; > /dev/null 2>&1"
execute_command "find . -maxdepth 2 -name '_test-*.log' -exec rm {} \; > /dev/null 2>&1"
execute_command "find . -maxdepth 1 -name '___*.ini' -exec rm {} \; > /dev/null 2>&1"
fi
echo -e ""
if [ $err != 0 ]; then
printf "${red}"
print_banner "TESTING FAILED"
printf "${normal}"
else
printf "${green}"
print_banner "TESTING PASSED"
printf "${normal}"
fi
echo -e ""
exit $err