def test_resolve(): from myia.utils import Named, Registry assert resolve_tracers('myia.utils.Named') == [(Named, ())] assert resolve_tracers('myia.utils.Named:BEEP') == [(Named, ["BEEP"])] assert (resolve_tracers('myia.utils.Named:BEEP:BOOP') == [ (Named, ["BEEP", "BOOP"]) ]) assert (resolve_tracers('myia.utils.Named("BEEP","BOOP")') == [ (Named, ("BEEP", "BOOP")) ]) assert (resolve_tracers('myia.utils.Named;myia.utils.Registry') == [ (Named, ()), (Registry, ()) ])
def pytest_configure(config): listener_pairs = [] if config.option.usepdb: os.environ['MYIA_PYTEST_USE_PDB'] = "1" if config.option.do_inject: from debug import do_inject # noqa if config.option.tracer: for tracer in config.option.tracer: listener_pairs += resolve_tracers(tracer) if config.option.mprof: listener_pairs.append((Profiler, ())) if config.option.trace_nodes: _context_managers.append(((lambda: DebugInherit(save_trace=True)), ())) def _make_trace_listeners(): listeners = [fn(*args) for fn, args in listener_pairs] return MultiTrace(*listeners) if listener_pairs: _context_managers.append((_make_trace_listeners, ()))