forked from kenzuya/unshackle
fix(session): retry an rnet response whose body ends early
This commit is contained in:
@@ -55,7 +55,7 @@ def test_a_with_block_gives_the_response_itself_and_its_content(cover_url: str)
|
||||
|
||||
|
||||
def test_the_end_of_the_with_block_closes_the_response(cover_url: str) -> None:
|
||||
with RnetSession().get(cover_url) as response:
|
||||
with RnetSession().get(cover_url, stream=True) as response:
|
||||
pass
|
||||
|
||||
with pytest.raises(RuntimeError):
|
||||
@@ -63,7 +63,10 @@ def test_the_end_of_the_with_block_closes_the_response(cover_url: str) -> None:
|
||||
|
||||
|
||||
def test_an_exception_in_the_with_block_propagates_and_the_response_still_closes(cover_url: str) -> None:
|
||||
with pytest.raises(ValueError, match="raised inside the with block"), RnetSession().get(cover_url) as response:
|
||||
with (
|
||||
pytest.raises(ValueError, match="raised inside the with block"),
|
||||
RnetSession().get(cover_url, stream=True) as response,
|
||||
):
|
||||
raise ValueError("raised inside the with block")
|
||||
|
||||
with pytest.raises(RuntimeError):
|
||||
|
||||
Reference in New Issue
Block a user