4 import os, sys, traceback
6 import time as THEBIGTIME
9 toolsWay = r'${toolsWay}'
10 resourcesWay = r'${resourcesWay}'
11 outWay = r'${sessionDir}'
14 listTest = ${listTest}
17 sys.path.append(toolsWay)
18 from TOOLS import TOOLS_class
19 my_tools = TOOLS_class(resourcesWay, tmpDir, toolsWay)
21 from TOOLS import SatNotApplicableError
23 # on set les variables d'environement
24 os.environ['TT_BASE_RESSOURCES'] = resourcesWay
25 sys.path.append(resourcesWay)
27 exec_result = open(r'${resultFile}', 'w')
28 exec_result.write('Open\n')
30 __stdout__ = sys.stdout
31 __stderr__ = sys.stderr
34 pylog = open(os.path.join(outWay, test[:-3] + ".result.py"), "w")
35 testout = open(os.path.join(outWay, test[:-3] + ".out.py"), "w")
40 pylog.write('#-*- coding:utf-8 -*-\n')
41 exec_result.write("Run %s " % test)
45 timeStart = THEBIGTIME.time()
46 execfile(os.path.join(outWay, test), globals(), locals())
47 timeTest = THEBIGTIME.time() - timeStart
48 except SatNotApplicableError, ex:
51 exec_result.write("NA\n")
52 timeTest = THEBIGTIME.time() - timeStart
53 pylog.write('status = "NA"\n')
54 pylog.write('time = "' + timeTest.__str__() + '"\n')
55 pylog.write('callback = "%s"\n' % reason)
59 if ignore.has_key(test):
61 reason = "Known Failure = %s\n\n" % ignore[test]
62 exec_result.write("%s\n" % status)
63 timeTest = THEBIGTIME.time() - timeStart
64 pylog.write('status = "%s" \n' % status)
65 pylog.write('time = "' + timeTest.__str__() + '"\n')
66 pylog.write('callback="""' + reason)
67 exc_type, exc_value, exc_traceback = sys.exc_info()
68 traceback.print_exception(exc_type,
75 exec_result.write("OK\n")
76 pylog.write('status = "OK"\n')
77 pylog.write('time = "' + timeTest.__str__() + '"\n')
80 sys.stdout = __stdout__
81 sys.stderr = __stderr__
82 my_tools.writeInFiles(pylog)
85 exec_result.write('Close\n')
88 if 'PY' not in '${sessionName}':
90 #killScript = os.path.join(os.environ['KERNEL_ROOT_DIR'],
94 #cmd = '{python} {killScript} {port}'.format(python=os.environ['PYTHONBIN'],
95 # killScript=killScript,
96 # port=salome_utils.getPortNumber())
97 cmd = 'killSalome.py {port}'.format( port=salome_utils.getPortNumber())