Ah... it's best to add a test case for any functionality you need, so that future changes don't break it. The delays were problematic. To test recv_nowait, you'd want to use a zpoller to check the socket for input, then use recv_nowait and assert that it succeeded.