Skip to content
Myr

Add testcase to demonstrate r.iter_lines() reentrancy issue

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Priit Laes · committed by Priit Laes · parent c53aa08 · Browse files · 1 file+17 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+17 added−0 removed

  • other:+17 added−0 removed

1 file+17 added−0 removed

modified:test_requests.py+17 added
1050 unmodified lines
1051 assert r.status_code == 2001052 assert 'application/json' in r.request.headers['Content-Type']1053 assert {'life': 42} == r.json()['json']10541055 def test_response_iter_lines(self):1056 r = requests.get(httpbin('stream/4'), stream=True)1057 assert r.status_code == 20010581059 it = r.iter_lines()1060 next(it)1061 assert len(list(it)) == 310621063 @pytest.mark.xfail1064 def test_response_iter_lines_reentrant(self):1065 """Response.iter_lines() is not reentrant safe"""1066 r = requests.get(httpbin('stream/4'), stream=True)1067 assert r.status_code == 20010681069 next(r.iter_lines())1070 assert len(list(r.iter_lines())) == 3107110721073class TestContentEncodingDetection(unittest.TestCase):10741075 def test_none(self):1076 encodings = requests.utils.get_encodings_from_content('')
563 unmodified lines