|
@@ -1,13 +1,37 @@
|
1
|
1
|
#-*- coding: utf-8 -*-
|
2
|
2
|
|
|
3
|
+##@brief Loader for tests which do not need an lodel installation
|
|
4
|
+#
|
|
5
|
+# Options
|
|
6
|
+################
|
|
7
|
+#
|
|
8
|
+# @note We can pass the path to a directory to write results file, nocontext_tests.log
|
|
9
|
+# It has to be at first, otherwise it will not be taken
|
|
10
|
+# and the default one, current directory, will be used.
|
|
11
|
+# The results are not displayed, only stored in nocontext_tests.log
|
|
12
|
+#
|
|
13
|
+# -f, --failfast
|
|
14
|
+#
|
|
15
|
+# Stop the test run on the first error or failure.
|
|
16
|
+# -v --verbose
|
|
17
|
+#
|
|
18
|
+# higher verbosity
|
|
19
|
+#
|
|
20
|
+#
|
|
21
|
+
|
3
|
22
|
import sys, os, os.path
|
4
|
23
|
import unittest
|
5
|
24
|
import nocontext_tests
|
6
|
25
|
|
7
|
26
|
loader = unittest.TestLoader()
|
8
|
27
|
|
|
28
|
+if ((len(sys.argv) > 1) and (sys.argv[1].startswith('-')) is False):
|
|
29
|
+ dpath = sys.argv[1]
|
|
30
|
+else:
|
|
31
|
+ dpath = '.'
|
|
32
|
+
|
9
|
33
|
suite = loader.discover('tests', pattern='nc_test*.py')
|
10
|
|
-with open(sys.argv[1]+'/nocontext_tests.log', 'w') as logfile:
|
|
34
|
+with open(dpath+'/nocontext_tests.log', 'w') as logfile:
|
11
|
35
|
unittest.TextTestRunner(
|
12
|
36
|
logfile,
|
13
|
37
|
failfast = '-f' in sys.argv,
|