l.t.StormStatementRecorder : class documentation

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.
Method __init__ Undocumented
Method queries Undocumented
Method count Undocumented
Method statements Undocumented
Method __enter__ Undocumented
Method __exit__ Undocumented
Method __str__ Undocumented
def __init__(self, tracebacks_if=False):
Undocumented
@property
def queries(self):
Undocumented
@property
def count(self):
Undocumented
@property
def statements(self):
Undocumented
def __enter__(self):
Undocumented
def __exit__(self, exc_type, exc_value, tb):
Undocumented
def __str__(self):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2019-10-15 00:00:11.