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
No related merge requests found
test_result = sci['object']
kw = sci['kwargs']
stop_date = kw.get('date') or DateTime()
test_result.setStopDate(stop_date)
test_result.setStopDate(kw.get('date') or DateTime())
if test_result.getPortalType() == 'Test Result':
has_unknown_result = False
edit_kw = dict(duration=0,
......@@ -35,8 +34,9 @@ elif test_result.getPortalType() == 'Test Result Line':
status = 'FAILED'
else:
status = 'PASSED'
duration = kw.get('duration') or (
stop_date - test_result.getStartDate()) * (24*60*60)
duration = kw.get('duration')
if duration is None:
duration = (test_result.getStopDate() - test_result.getStartDate()) * (24*60*60)
cmdline = kw.get('command', getattr(test_result, 'cmdline', ''))
if same_type(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