Commit d6d7b72d authored by Julien Muchembled's avatar Julien Muchembled

erp5_test_result: fix default value of 'duration' in TestResult_complete

In addition to TypeEror when a 'date' is given, this also accepts duration=0.
parent 744273f2
test_result = sci['object'] test_result = sci['object']
kw = sci['kwargs'] kw = sci['kwargs']
stop_date = kw.get('date') or DateTime() test_result.setStopDate(kw.get('date') or DateTime())
test_result.setStopDate(stop_date)
if test_result.getPortalType() == 'Test Result': if test_result.getPortalType() == 'Test Result':
has_unknown_result = False has_unknown_result = False
edit_kw = dict(duration=0, edit_kw = dict(duration=0,
...@@ -35,8 +34,9 @@ elif test_result.getPortalType() == 'Test Result Line': ...@@ -35,8 +34,9 @@ elif test_result.getPortalType() == 'Test Result Line':
status = 'FAILED' status = 'FAILED'
else: else:
status = 'PASSED' status = 'PASSED'
duration = kw.get('duration') or ( duration = kw.get('duration')
stop_date - test_result.getStartDate()) * (24*60*60) if duration is None:
duration = (test_result.getStopDate() - test_result.getStartDate()) * (24*60*60)
cmdline = kw.get('command', getattr(test_result, 'cmdline', '')) cmdline = kw.get('command', getattr(test_result, 'cmdline', ''))
if same_type(cmdline, []): if same_type(cmdline, []):
cmdline = ' '.join(map(repr, cmdline)) cmdline = ' '.join(map(repr, cmdline))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment