Opened 10 years ago

Closed 10 years ago

#23450 closed Bug (fixed)

Transient failure of requests.tests.RequestsTests.test_far_expiration

Reported by: Simon Charette Owned by: Paweł Marczewski
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: pwmarcz@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Traceback (most recent call last):
  File "/home/jenkins/workspace/django-master/database/mysql/python/python2.7/tests/requests/tests.py", line 178, in test_far_expiration
    self.assertEqual(datetime_cookie['expires'], 'Sat, 01-Jan-2028 04:05:06 GMT')
AssertionError: u'Sat, 01-Jan-2028 04:05:07 GMT' != u'Sat, 01-Jan-2028 04:05:06 GMT'
- Sat, 01-Jan-2028 04:05:07 GMT
?                         ^
+ Sat, 01-Jan-2028 04:05:06 GMT
?                         ^

Attachments (1)

23450.diff (771 bytes ) - added by Tim Graham 10 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Simon Charette, 10 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Claude Paroz, 10 years ago

This is probably related to this part of django/http/response.py:

                delta = expires - expires.utcnow()
                # Add one second so the date matches exactly (a fraction of
                # time gets lost between converting to a timedelta and
                # then the date string).
                delta = delta + datetime.timedelta(seconds=1)

The test should admit n+1 second too, IMHO.

comment:3 by Paweł Marczewski, 10 years ago

Owner: changed from nobody to Paweł Marczewski
Status: newassigned

comment:4 by Paweł Marczewski, 10 years ago

Cc: pwmarcz@… added
Has patch: set
Last edited 10 years ago by Tim Graham (previous) (diff)

comment:5 by Tim Graham, 10 years ago

Patch needs improvement: set

I left comments for improvement on the PR. Please uncheck "Patch needs improvement" when you update it, thanks.

by Tim Graham, 10 years ago

Attachment: 23450.diff added

comment:6 by Tim Graham, 10 years ago

Patch needs improvement: unset

Attached a patch to admit n+1 seconds as suggested by Claude.

comment:7 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In df3cc53fda8579fdeea84a78650f2d189f7b2c75:

Fixed #23450 -- Fixed transient failure of requests...test_far_expiration.

Note: See TracTickets for help on using tickets.
Back to Top