Test socket.makefile() with line-based I/O.
(selenium_nodesock)
| 422 | |
| 423 | |
| 424 | def test_socket_makefile(selenium_nodesock): |
| 425 | """Test socket.makefile() with line-based I/O.""" |
| 426 | |
| 427 | def handler(conn, _addr): |
| 428 | conn.sendall(b"line1\nline2\nline3\n") |
| 429 | conn.close() |
| 430 | |
| 431 | @run_in_pyodide |
| 432 | def run(selenium, host, port): |
| 433 | import socket |
| 434 | |
| 435 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 436 | s.connect((host, port)) |
| 437 | |
| 438 | f = s.makefile("r") |
| 439 | lines = f.readlines() |
| 440 | f.close() |
| 441 | s.close() |
| 442 | return [l.strip() for l in lines] |
| 443 | |
| 444 | with tcp_server(handler) as (host, port): |
| 445 | result = run(selenium_nodesock, host, port) |
| 446 | assert result == ["line1", "line2", "line3"] |
| 447 | |
| 448 | |
| 449 | def test_socket_asyncio_concurrent(selenium_nodesock): |
nothing calls this directly
no test coverage detected
searching dependent graphs…