Opened 10 years ago
Last modified 10 years ago
#23792 closed Cleanup/optimization
Random test failure of TestCookieStorage.test_reset_cookie — at Initial Version
Reported by: | Thomas C | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
This test fails randomly, as seen in http://djangoci.com/job/django-pull-requests/1528/database=postgres,python=python3.4/testReport/junit/django.contrib.formtools.tests.wizard.test_cookiestorage/TestCookieStorage/test_reset_cookie/
After some investigation, I can reproduce the failure by adding a time.sleep(1)
after this line https://github.com/django/django/blob/88b2a20f047347da86f448fe09a56251d29e4168/django/core/signing.py#L183.
I suggest the introduction of a context manager freeze_time
to handle this issue (there is also a recurring pattern for that in Django test suite).