forked from LMFDB/lmfdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·50 lines (42 loc) · 1.33 KB
/
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
48
49
#!/usr/bin/env bash
# This script runs nosetests for the whole project.
# It also generates a coverage report when the "coverage" module is installed.
# When you specify the argument 'html', a HTML report will be generated, too.
# To run it, first install or upgrade "nose", "unittest2" and "coverage".
# e.g. $ pip install --user -U nose coverage unittest2
# or inside the Sage environment: $ easy_install -U nose
# $ easy_install -U coverage
# $ easy_install -U unittest2
# Second, call it in three ways, either
# $ ./test.sh to test all
# or
# $ ./test.sh coverage
# to test all and report test coverage
# or (for example)
# $ ./test.sh lmfdb/knowledge
# to test only a part of LMFDB
cd `dirname "$0"`
# get rid of all cached .pyc files!
find . -name '*.pyc' -delete
HTML=''
WHAT=''
COVER=''
if [[ "$1" == "coverage" ]]; then
rm -rf lmfdb/cover
HTML='--cover-html'
COVER='--with-coverage --cover-erase --cover-package=lmfdb $HTML'
else
WHAT="$@"
fi
ARGS='-v -s --testmatch="(?:^|[\b_\./-])[Tt]est_"'
SAGE_COMMAND=$SAGE
if [[ "$SAGE_COMMAND" == "" ]]; then
SAGE_COMMAND=sage
fi
echo "Using Sage command $SAGE_COMMAND"
if [[ -n $WHAT ]]; then
eval "$SAGE_COMMAND -sh -c 'nosetests $ARGS $WHAT $COVER'"
else
cd lmfdb
eval "$SAGE_COMMAND -sh -c 'nosetests $ARGS $COVER'"
fi