Fix resize and poller races; add coverage
- Fix resize message handling when session already exists - Guard poller selector.modify against removed fds - Handle send_bytes race when master_fd closes - Add tests for resize edge case, poller write KeyError, send_bytes race
This commit is contained in:
@@ -71,6 +71,17 @@ class TestPoller:
|
||||
# Should not raise
|
||||
poller.remove_file(999)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_write_handles_removed_fd(self):
|
||||
poller = Poller()
|
||||
poller._loop = asyncio.get_event_loop()
|
||||
|
||||
with patch.object(poller._selector, "register"):
|
||||
poller.add_file(42)
|
||||
|
||||
with patch.object(poller._selector, "modify", side_effect=KeyError()):
|
||||
await poller.write(42, b"test")
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_write_creates_queue(self):
|
||||
"""Test that write creates a write queue if needed."""
|
||||
|
||||
Reference in New Issue
Block a user