Allow setting unhandled_panic
behavior as option on tokio::test
#6527
Labels
A-tokio
Area: The main tokio crate
A-tokio-macros
Area: The tokio-macros crate
C-feature-request
Category: A feature request.
Is your feature request related to a problem? Please describe.
I have several unit tests that run some handler code that is under test in a
tokio::spawn
ed task, and sends/receives bytes to/from that handler code from the main task. My AsyncRead + AsyncWrite mock will panic if it sees unexpected bytes, and if this happens in the background task the test will hang. I'd prefer the test to shut down in this scenario, and so I'm using theunhandled_panic
option introduced by #4516.Describe the solution you'd like
#[tokio::test(unhandled_panic = ShutdownRuntime)
Describe alternatives you've considered
Currently I manually set up a tokio runtime for my tests that require this behavior.
The text was updated successfully, but these errors were encountered: