| 303 | |
| 304 | |
| 305 | def test_client_closed_state_using_implicit_open(): |
| 306 | client = httpx.Client(transport=httpx.MockTransport(hello_world)) |
| 307 | |
| 308 | assert not client.is_closed |
| 309 | client.get("http://example.com") |
| 310 | |
| 311 | assert not client.is_closed |
| 312 | client.close() |
| 313 | |
| 314 | assert client.is_closed |
| 315 | |
| 316 | # Once we're close we cannot make any more requests. |
| 317 | with pytest.raises(RuntimeError): |
| 318 | client.get("http://example.com") |
| 319 | |
| 320 | # Once we're closed we cannot reopen the client. |
| 321 | with pytest.raises(RuntimeError): |
| 322 | with client: |
| 323 | pass # pragma: no cover |
| 324 | |
| 325 | |
| 326 | def test_client_closed_state_using_with_block(): |