Part of lp.testing View In Hierarchy
A Storm tracer to record all database queries. Use the HasQueryCount matcher to check that code makes efficient use of the database. Similar to `RequestTimelineCollector`, but can operate outside a web request context and only collects Storm queries. It also meets the context manager protocol, so you can gather queries easily: with StormStatementRecorder() as recorder: do somestuff self.assertThat(recorder, HasQueryCount(LessThan(42))) This also can be useful for investigation, such as in make harness. Try printing it after you have collected some queries. You can even collect tracebacks, passing True to "tracebacks_if" for tracebacks of every SQL query, or a callable that takes the SQL query string and returns a boolean decision as to whether a traceback is desired.