mocking doesn't drain iterator

Bug #1616751 reported by Jamie Lennox
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
requests-mock
In Progress
Low
Jamie Lennox

Bug Description

If you pass a generator to data in requests it will iterate over the generator and include that info into the request. This has the result of draining the provided iterator. Currently we don't do this, nor do we read provided files.

It's rare this would be something that an application is testing the result of. The provided case is that swiftclient updates the md5sum as the iterator is read which is currently not happening.

The downside of this is that the body available in last_request is now expended. Again this probably doesn't matter but it's a change in behaviour.

Using itertools.tee we can both drain the generator and maintain the request history - but i'm not sure it's worth it.

Changed in requests-mock:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to requests-mock (master)

Fix proposed to branch: master
Review: https://review.openstack.org/360300

Changed in requests-mock:
assignee: nobody → Jamie Lennox (jamielennox)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on requests-mock (master)

Change abandoned by Jamie Lennox (<email address hidden>) on branch: master
Review: https://review.openstack.org/360300
Reason: Moved to https://github.com/jamielennox/requests-mock/pull/32

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.