Skip to content

test/test_collect: fix some timezone dependent tests

Jérome Perrin requested to merge fix/timezone_test_failure into master

This test was using time.strftime which uses the current machine timezone, but collection is done in UTC timezone, so the test was sometimes failing because the strftime('%Y-%m-%d') was another day than the same time in UTC time zone.

This test https://erp5js.nexedi.net/#/test_result_module/20210811-96D6B55F/8 for example had the problem. By using faketime and TZ=Europe/Paris environment variable, the same problems reproduced locally 100% of times.

The fix is to always use datetime.utcnow().strftime('%Y-%m-%d'), to not depend on the timezone.

Merge request reports