In this chapter, we understood the difference between synchronous and asynchronous execution. We created a new version of the RESTful API that takes advantage of the non-blocking features in Tornado, combined with an asynchronous execution. We improved the scalability of our existing API and made it possible to start executing other requests while waiting for slow I/O operations with sensors and actuators. We avoided splitting our methods into multiple methods with callbacks by using the tornado.gen generator-based interface that Tornado provides, to make it easier to work in an asynchronous environment.
Then, we set up a testing environment. We installed pytest, along with many plugins, to make it easy to discover and execute unit tests. We wrote the first round of unit tests, measured test coverage, and then wrote additional unit tests to improve that test coverage....