The init_types_collection() function installs the tracing callbacks and sets the filename filter, but doesn't reset the globals containing collected data. Maybe it should also do that. Or maybe we need a separate API to do that. (Currently the pyannotate unit tests reset a whole bunch of globals at the start of each test -- this should become a single call.)
Second, with collect_types.collect() only calls resume() and pause() -- we could use another context manager that calls init_types_collection() and dump_stats() as well.
(Note that the non-context-manager APIs are also important, e.g. for use in test fixtures, where there are traditionally separate setUp() and tearDown() methods.)
The
init_types_collection()
function installs the tracing callbacks and sets the filename filter, but doesn't reset the globals containing collected data. Maybe it should also do that. Or maybe we need a separate API to do that. (Currently the pyannotate unit tests reset a whole bunch of globals at the start of each test -- this should become a single call.)Second,
with collect_types.collect()
only callsresume()
andpause()
-- we could use another context manager that callsinit_types_collection()
anddump_stats()
as well.(Note that the non-context-manager APIs are also important, e.g. for use in test fixtures, where there are traditionally separate
setUp()
andtearDown()
methods.)