This repository was archived by the owner on Oct 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathruntest_context.sh
More file actions
executable file
·96 lines (91 loc) · 2.77 KB
/
runtest_context.sh
File metadata and controls
executable file
·96 lines (91 loc) · 2.77 KB
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
#!/bin/bash
#
# This file is part of Lodel 2 (https://github.com/OpenEdition)
#
# Copyright (C) 2015-2017 Cléo UMS-3287
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Usage : ./runtest [OPTIONS] [test_module[.test_class][ test_module2[.test_class2]...]
#########
#
# Options list :
################
#
# -b, --buffer
#
# The standard output and standard error streams are buffered during the test run. Output during a passing test is discarded. Output is echoed normally on test fail or error and is added to the failure messages.
#
# -c, --catch
#
# Control-C during the test run waits for the current test to end and then reports all the results so far. A second control-C raises the normal KeyboardInterrupt exception.
#
#
# -f, --failfast
#
# Stop the test run on the first error or failure.
#
# -h, --help
#
# Get some help
#
# -v, --verbose
#
# higher verbosity
#
# Examples :
############
#
# Running all discoverables tests :
# ./runtest
#
# Running only Em test about component object (only tests about the __init__ and modify_rank methods) with higher verbosity and failfast :
# ./runtest -fv EditorialModel.test.test_component.TestInit EditorialModel.test.test_component.TestModifyRank
#
#
# Running only Em tests
# ./runtest discover EditorialModel
#
# More details :
################
#
# https://docs.python.org/3.4/library/unittest.html
#
if test ! -f lodel/buildconf.py
then
echo "You have to build the project before running the tests"
echo "See README"
exit 1
fi
PYTHON='env python3'
testdir=$(mktemp -td "lodel2_unittest_instance_XXXXXXXX")
install_model_dir="[@]INSTALLMODEL_DIR[@]"
if [ ! -d "$install_model_dir" ]
then
install_model_dir="$(dirname $0)/progs/slim/install_model/"
fi
libdir="$(dirname $(realpath $0))/lodel"
rmdir $testdir
progs/create_instance test_instance $testdir "$install_model_dir" examples/em_test.pickle "$libdir"
echo progs/create_instance test_instance $testdir "$install_model_dir" examples/em_test.pickle "$libdir"
cp -R examples $testdir
cp -R tests $testdir
cd $testdir
chmod +x lodel_admin.py
rm -R conf.d && mv tests/tests_conf.d conf.d
make
make refresh_plugins
$PYTHON loader.py $@ && ret_status=0 || ret_status=1
rm -Rf $testdir
exit $ret_status