blob: 7e5df250f3adc0e5c0cf2f9d5d7322e73c12302b (
plain)
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
|
#!/bin/sh
VENV_DIR=".ci-build-venv"
# Directory where coverage HTML report will be written.
COVERAGE_REPORT_DIR="lava_tool_coverage"
set -e
if which pep8 >/dev/null 2>&1; then
# check style before anything
pep8 --ignore E501,W291 lava*
fi
if test -z "$VIRTUAL_ENV"; then
set -x
virtualenv $VENV_DIR
. $VENV_DIR/bin/activate
python setup.py develop
fi
# requirement for integration tests
if ! pip show Flask | grep -q Flask; then
pip install 'Flask==0.9'
fi
if ! pip show PyYAML | grep -q PyYAML; then
pip install PyYAML
fi
# requirement for unit tests
if ! pip show mocker | grep -q mocker; then
pip install mocker
fi
if ! pip show mock | grep -q mock; then
pip install mock
fi
# Requirement to run code coverage tests.
if ! pip show coverage | grep -q coverage; then
pip install coverage
fi
if test -z "$DISPLAY"; then
# actual CI
# will install tests dependencies automatically. The output is also more
# verbose
python setup.py test < /dev/null
# integration-tests will pick this up and provide detailed output
export VERBOSE=1
else
# in a development workstation, this will produce shorter/nicer output, but
# requires the test dependencies to be installed manually (or by running
# `python setup.py test` before).
python -m unittest lava_tool.tests.test_suite < /dev/null
fi
if test -d $COVERAGE_REPORT_DIR; then
rm -rf $COVERAGE_REPORT_DIR
fi
# Runs python-coverage.
python-coverage run -m unittest lava_tool.tests.test_suite 2>/dev/null && python-coverage html
./integration-tests
# if we reached this point we are good
set +x
echo
echo '\o/ all tests passed!'
echo
|