forked from openedx-unsupported/bok-choy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_tests.sh
executable file
·52 lines (39 loc) · 1.24 KB
/
run_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
#!/usr/bin/env bash
# Usage: ./run_tests.sh [TEST_MODULE]
#
# Examples:
# Run all tests: ./run_tests.sh
# Run the input tests only: ./run_tests.sh test_inputs.py
set -e
function echo_task {
echo $'\n'
echo "====== $1"
}
REPO_ROOT=`dirname $BASH_SOURCE`
SERVER_PORT=8003
export SCREENSHOT_DIR=$REPO_ROOT/screenshots
# Set up the screenshot directory
mkdir -p $SCREENSHOT_DIR
rm -rf $SCREENSHOT_DIR/*.png
# Ensure that the server is shut down on exit
trap "kill 0" SIGINT SIGTERM EXIT
# Start the server for the test fixture site
echo_task "Start server for test fixture site"
python -m tests.http_server $SERVER_PORT 2> /dev/null &
echo "Running test server on port $SERVER_PORT"
echo_task "Run unit test suite"
coverage run -m nose $REPO_ROOT/tests/$1
# Skip other tests if we've specified a particular unit test
if [ -z $1 ]; then
echo_task "Coverage report"
coverage report
echo_task "Install bok-choy"
pip uninstall bok-choy -y &> /dev/null || true
python setup.py install
echo_task "Run tutorial examples"
python docs/code/round_1/test_search.py
python docs/code/round_2/test_search.py
python docs/code/round_3/test_search.py
echo_task "Build docs"
python setup.py build_sphinx
fi