diff options
author | cjstapleton <chelsea.j.stapleton@gmail.com> | 2014-02-28 10:08:57 -0600 |
---|---|---|
committer | cjstapleton <chelsea.j.stapleton@gmail.com> | 2014-02-28 10:08:57 -0600 |
commit | 930f03c8649613da9efb7915e17428dd1e8526af (patch) | |
tree | 08bd8fefc6fbbad9c6c55d44f510eeb1b9ba0206 /test_requests.py | |
parent | e909a923431be2597498c33adc57707f0488bc76 (diff) | |
download | python-requests-930f03c8649613da9efb7915e17428dd1e8526af.tar.gz |
Add timeout to stream with testing
Fixes Issue #1803
Diffstat (limited to 'test_requests.py')
-rwxr-xr-x | test_requests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test_requests.py b/test_requests.py index 3d7cdaaf..0fe849d4 100755 --- a/test_requests.py +++ b/test_requests.py @@ -1170,6 +1170,15 @@ class TestMorselToCookieMaxAge(unittest.TestCase): with pytest.raises(TypeError): morsel_to_cookie(morsel) +class TestTimeout: + def test_stream_timeout(self): + try: + r = requests.get('https://httpbin.org/delay/10', timeout=5.0) + except requests.exceptions.Timeout as e: + assert 'Read timed out' in e.args[0].args[0] + if __name__ == '__main__': unittest.main() + + |