[IMP] *: add (individual) timings to test cron runner

Useful to know if the crons are slow during testing.
This commit is contained in:
Xavier Morel 2019-10-11 09:09:43 +02:00
parent bad016b830
commit e5efd52674

View File

@ -893,11 +893,12 @@ class Environment:
crons = xids or self._default_crons
print('running crons', crons, file=sys.stderr)
for xid in crons:
t0 = time.time()
print('\trunning cron', xid, '...', file=sys.stderr)
_, model, cron_id = self('ir.model.data', 'xmlid_lookup', xid)
assert model == 'ir.cron', "Expected {} to be a cron, got {}".format(xid, model)
self('ir.cron', 'method_direct_trigger', [cron_id], **kw)
print('\tdone', file=sys.stderr)
print('\tdone %.3fs' % (time.time() - t0), file=sys.stderr)
print('done', file=sys.stderr)
# sleep for some time as a lot of crap may have happened (?)
wait_for_hook()