Skip to content

Commit

Permalink
pytest-httpbin doesn't support chunked requests on Python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Grainger committed Apr 4, 2017
1 parent 1092bcd commit dc2dc30
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/integration/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import vcr
from assertions import assert_cassette_empty, assert_is_json


requests = pytest.importorskip("requests")
from requests.exceptions import ConnectionError # noqa E402


def test_status_code(httpbin_both, tmpdir):
Expand Down Expand Up @@ -100,11 +100,26 @@ def test_post(tmpdir, httpbin_both):
assert req1 == req2


def test_post_chunked_binary(tmpdir, httpbin_both):
def test_post_chunked_binary(tmpdir, httpbin):
'''Ensure that we can send chunked binary without breaking while trying to concatenate bytes with str.'''
data1 = iter([b'data', b'to', b'send'])
data2 = iter([b'data', b'to', b'send'])
url = httpbin_both.url + '/post'
url = httpbin.url + '/post'
with vcr.use_cassette(str(tmpdir.join('requests.yaml'))):
req1 = requests.post(url, data1).content

with vcr.use_cassette(str(tmpdir.join('requests.yaml'))):
req2 = requests.post(url, data2).content

assert req1 == req2


@pytest.mark.xfail('sys.version_info >= (3, 6)', strict=True, raises=ConnectionError)
def test_post_chunked_binary_secure(tmpdir, httpbin_secure):
'''Ensure that we can send chunked binary without breaking while trying to concatenate bytes with str.'''
data1 = iter([b'data', b'to', b'send'])
data2 = iter([b'data', b'to', b'send'])
url = httpbin_secure.url + '/post'
with vcr.use_cassette(str(tmpdir.join('requests.yaml'))):
req1 = requests.post(url, data1).content
print(req1)
Expand Down

0 comments on commit dc2dc30

Please sign in to comment.