-
Notifications
You must be signed in to change notification settings - Fork 10
/
test.sh
executable file
·47 lines (40 loc) · 873 Bytes
/
test.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
#!/bin/bash
function module_exist {
if [ -f "./test/$1_test.py" ]; then
return 0
fi
return 1
}
function test_module {
py="$1"
module="$2"
path=`command -v $py`
if [ -x "$path" ]; then
echo "using $path"
if module_exist $module; then
echo "Testing $2"
eval "$path -m test.$2_test "
else
eval "$path -m test.run"
fi
else
echo "$py 不可执行"
fi
}
function test {
py_exe="$1"
module="$2"
if [ -n "$py_exe" ]; then
test_module $py_exe $module
else
echo "自动测试"
if [ -x "`command -v python`" ]; then
python2 --version
command python2 -m test.run
python3 --version
command python3 -m test.run
echo "----------"
fi
fi
}
test $1 $2