Find and use some unit test framework that support asynchronous operations. Good candidate is: http://www.tornadoweb.org/en/stable/