Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_json_output():
with Profiler() as profiler:
long_function_a()
long_function_b()
output_data = profiler.output(renderers.JSONRenderer(), root=True)
output = json.loads(output_data)
assert output['function'] == 'test_json_output'
assert len(output['children']) == 2
def test_json(deep_profiler_session):
JSONRenderer().render(deep_profiler_session)
def get_renderer_class(renderer):
if renderer == 'text':
return renderers.ConsoleRenderer
elif renderer == 'html':
return renderers.HTMLRenderer
elif renderer == 'json':
return renderers.JSONRenderer
else:
return object_with_import_path(renderer)