All 9 combinations of two consecutive shutdown() calls should succeed (Linux behavior).
(selenium_nodesock)
| 563 | |
| 564 | |
| 565 | def test_socket_shutdown_pairs(selenium_nodesock): |
| 566 | """All 9 combinations of two consecutive shutdown() calls should succeed (Linux behavior).""" |
| 567 | |
| 568 | server_conns = [] |
| 569 | |
| 570 | def handler(conn, _addr): |
| 571 | server_conns.append(conn) |
| 572 | try: |
| 573 | while True: |
| 574 | data = conn.recv(1024) |
| 575 | if not data: |
| 576 | break |
| 577 | conn.sendall(data) |
| 578 | except OSError: |
| 579 | pass |
| 580 | |
| 581 | @run_in_pyodide |
| 582 | def run(selenium, host, port, first, second): |
| 583 | import socket |
| 584 | |
| 585 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 586 | s.connect((host, port)) |
| 587 | s.sendall(b"ping") |
| 588 | s.recv(1024) |
| 589 | |
| 590 | s.shutdown(first) |
| 591 | s.shutdown(second) |
| 592 | s.close() |
| 593 | |
| 594 | shut_values = [0, 1, 2] |
| 595 | for first in shut_values: |
| 596 | for second in shut_values: |
| 597 | with tcp_server(handler) as (host, port): |
| 598 | run(selenium_nodesock, host, port, first, second) |
| 599 | server_conns.clear() |
| 600 | |
| 601 | |
| 602 | def test_socket_nonblocking_recv_with_buffered_data(selenium_nodesock): |
nothing calls this directly
no test coverage detected
searching dependent graphs…