forked from LMFDB/lmfdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·36 lines (29 loc) · 1.09 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
#!/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 two ways, either $ ./test.sh for coverage to test all
# or to test only a part of LMFDB: $ ./test lmfdb/knowledge
cd `dirname "$0"`
# get rid of all cached .pyc files!
find . -name '*.pyc' -delete
HTML=''
WHAT=''
if [[ "$1" == "html" ]]; then
rm -rf lmfdb/cover
HTML='--cover-html'
else
WHAT="$@"
fi
ARGS='-v -s --testmatch="(?:^|[\b_\./-])[Tt]est_"'
if [[ -n $WHAT ]]; then
eval "sage -sh -c 'nosetests $ARGS $WHAT'"
else
cd lmfdb
eval "sage -sh -c 'nosetests $ARGS --with-coverage --cover-erase --cover-package=lmfdb $HTML'"
fi