Opened 7 years ago

Closed 6 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 6 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 7 years ago by Simon Charette

Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by Claude Paroz

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 Changed 7 years ago by Paweł Marczewski

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

comment:4 Changed 7 years ago by Paweł Marczewski

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

comment:5 Changed 7 years ago by Tim Graham

Patch needs improvement: set

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

Changed 6 years ago by Tim Graham

Attachment: 23450.diff added

comment:6 Changed 6 years ago by Tim Graham

Patch needs improvement: unset

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

comment:7 Changed 6 years ago by Tim Graham <timograham@…>

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