Test that sending data after the remote side closes raises an error.
(selenium_nodesock)
| 393 | |
| 394 | |
| 395 | def test_socket_send_after_remote_close(selenium_nodesock): |
| 396 | """Test that sending data after the remote side closes raises an error.""" |
| 397 | |
| 398 | def handler(conn, _addr): |
| 399 | conn.close() |
| 400 | |
| 401 | @run_in_pyodide(packages=["pytest"]) |
| 402 | def run(selenium, host, port): |
| 403 | import socket |
| 404 | import time |
| 405 | |
| 406 | import pytest |
| 407 | |
| 408 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 409 | s.connect((host, port)) |
| 410 | |
| 411 | # Give time for the FIN to arrive |
| 412 | time.sleep(0.5) |
| 413 | |
| 414 | with pytest.raises(OSError): |
| 415 | # Send enough data to trigger the error |
| 416 | for _ in range(10): |
| 417 | s.sendall(b"X" * 4096) |
| 418 | time.sleep(0.05) |
| 419 | |
| 420 | with tcp_server(handler) as (host, port): |
| 421 | run(selenium_nodesock, host, port) |
| 422 | |
| 423 | |
| 424 | def test_socket_makefile(selenium_nodesock): |
nothing calls this directly
no test coverage detected
searching dependent graphs…