How does MonkeyType affect performance and stability?

One needs some load for MonkeyType to generate the sqlite databases. Generally using your test suite as the load doesn’t work great, because it’s full of mocks.

This is a bit of a yellow flag. Unit tests are great, and tend to use mocks, but if that’s all you have, then you aren’t really testing your code like it will work in production.

Many projects have some sort of integration test that actually runs the code very much like in production with no mocks at all, and in my experience, these tests regularly find issues that the unit tests don’t.

One possibility would be writing such an integration test first, which would have value on all its own, and then using that test to run MonkeyType or PyAnnotate and get “real” signatures without the mocks.

1 Like