You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
1. Successful Stream Close Within Timeout
Purpose: Ensure
send_messagesucceeds and does not raise an error under normal conditions.Test Setup:
send_messageto complete within 1 second.muxed_conn.is_shutting_down()returnsFalse.Expected Result:
2. Stream Close Times Out
Purpose: Verify that a
TimeoutErroris raised whensend_messagetakes too long.Test Setup:
send_messageto block > 5 seconds (e.g., usingawait trio.sleep(6)).muxed_conn.is_shutting_down()returnsFalse.Expected Result:
trio.TooSlowErroris caught.TimeoutError("Stream close timed out")is raised.3. Muxed Connection Unavailable (Not Shutting Down)
Purpose: Ensure a
RuntimeErroris raised when the connection is unavailable unexpectedly.Test Setup:
send_messageto raiseMuxedConnUnavailable.muxed_conn.is_shutting_down()returnsFalse.Expected Result:
RuntimeError("Failed to send close message: muxed connection unavailable")is raised.4. Muxed Connection Unavailable (During Shutdown)
Purpose: Confirm that no error is raised if the connection is unavailable but shutting down.
Test Setup:
send_messageto raiseMuxedConnUnavailable.muxed_conn.is_shutting_down()returnsTrue.Expected Result:
5. Unexpected Exception During send_message
Purpose: Ensure that unexpected exceptions are surfaced correctly.
Test Setup:
send_messageto raise a generic exception (e.g., ValueError("boom")).Expected Result:
Optional Utility:
You can also use
pytest-trioandunittest.mock.AsyncMockto easily simulate async behaviors.Beta Was this translation helpful? Give feedback.
All reactions