Files
WoW-Hybrid-gateway/tests/debug_client_owner_reply_test.py
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

23 lines
1001 B
Python

"""A closed diagnostic peer must not escape the owner error handler."""
import socket,sys,unittest
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
from debug_client_owner import send_diagnostic_error
class OwnerReplyTest(unittest.TestCase):
def test_timeout_peer_then_following_connection(self):
owner,peer=socket.socketpair()
try:
peer.close()
self.assertFalse(send_diagnostic_error(owner,BrokenPipeError('peer timed out')))
finally:owner.close()
owner,peer=socket.socketpair()
try:
self.assertTrue(send_diagnostic_error(owner,ValueError('bounded code read rejected')))
self.assertEqual(peer.recv(512),b'ERROR bounded code read rejected\n')
finally:owner.close();peer.close()
def test_connection_reset_is_nonfatal(self):
class Reset:
def sendall(self,body):raise ConnectionResetError('observer left')
self.assertFalse(send_diagnostic_error(Reset(),ValueError('inspection complete')))
if __name__=='__main__':unittest.main()