35 log = Common.get_logger()
37 parser = argparse.ArgumentParser(usage=
'%(prog)s PATH [PATH] ...')
38 parser.add_argument(
'paths',
41 help=
'Path containing test python scripts to test')
42 args = parser.parse_args()
46 if not os.path.exists(p):
47 log.error(
'Path %s does not exist', p)
49 tests = [f
for f
in os.listdir(p)
if f.startswith(
'test_')
and f.endswith(
'.py')]
50 log.info(
'Testing %d test scripts from path %s', len(tests), p)
52 cmd =
'TRIGVALSTEERING_DRY_RUN=1 {:s}'.
format(p+
'/'+test)
53 log_file =
'{:s}.unitTest.log'.
format(test)
54 cmd +=
' >{:s} 2>&1'.
format(log_file)
55 ret_code = subprocess.call(cmd, shell=
True)
60 status_str =
'FAILED WITH CODE {:d}'.
format(ret_code)
64 status_str =
'ERROR IN LOG {:s}:'.
format(log_file)
65 log.info(
'---- %s ---- %s', test, status_str)
73 log.error(
'Test failed but no ERROR messages found, printing full log below')
74 with open(log_file)
as f: