forked from simon-anders/htseq
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathtest.sh
executable file
·101 lines (89 loc) · 1.98 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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# Adapted from python-igraph, original author Tamas Nepus:
# https://github.com/igraph/python-igraph/blob/709e7023aef4f4c4c93d385f4ed11adab6f7cbae/test.sh
PYTHON=python3
###############################################################################
set -e
SCRIPT_FOLDER=$(realpath $(dirname $0))
CLEAN=0
CONDA=0
PYTEST_ARGS=test
VENV_DIR=.venv
VERBOSE=0
SKIP_INSTALL=0
GOT_CLI_OPTS=0
while getopts ":cadovst:k:" OPTION; do
if [ x$GOT_CLI_OPTS = x0 ]; then
echo "Command line options:"
fi
echo "$OPTION"
case $OPTION in
c)
CLEAN=1
;;
a)
CONDA=1
;;
d)
PYTEST_ARGS='--doctest-glob="*.rst" doc/*.rst doc/tutorials/tss.rst'
;;
o)
PYTEST_ARGS=test/test_htseq-count.py
;;
t)
PYTEST_ARGS=$OPTARG
;;
k)
PYTEST_ARGS="${PYTEST_ARGS} -k $OPTARG"
;;
s)
SKIP_INSTALL=1
;;
v)
VERBOSE=1
;;
\?)
echo "Usage: $0 [-coavtk]"
;;
esac
done
shift $((OPTIND -1))
if [ x$CLEAN = x1 ]; then
rm -rf build/
fi
if [ x$CONDA = x1 ]; then
if [ -d /opt/anaconda ]; then
source /opt/anaconda/bin/activate
conda activate scanpy
else
source /Users/z3535002/opt/miniconda3/bin/activate
conda activate htseq_dev
fi
PYTHON=python
PIP=pip
PYTEST=pytest
else
PYTHON=$VENV_DIR/bin/python
PIP=$VENV_DIR/bin/pip
PYTEST=$VENV_DIR/bin/pytest
if [ ! -d $VENV_DIR ]; then
python -m venv $VENV_DIR
fi
$VENV_DIR/bin/pip install -U pip wheel numpy pybigwig
fi
if [ x$SKIP_INSTALL = x0 ]; then
$PIP install .[htseq-qa,test]
elif [ x$VERBOSE = x1 ]; then
echo "Skipping install"
fi
if [ x$CONDA = x1 ]; then
if [ x$VERBOSE = x1 ]; then
echo "${PYTEST} ${PYTEST_ARGS}"
fi
$PYTEST ${PYTEST_ARGS}
else
if [ x$VERBOSE = x1 ]; then
echo "PATH=${VENV_DIR}/bin:${PATH} ${PYTEST} ${PYTEST_ARGS}"
fi
PATH=${SCRIPT_FOLDER}/${VENV_DIR}/bin:${PATH} $PYTEST ${PYTEST_ARGS}
fi