pytest-plugins icon indicating copy to clipboard operation
pytest-plugins copied to clipboard

pytest-profiling: ability to have a svg output per test

Open benjaminrigaud opened this issue 7 years ago • 3 comments

Hello,

I had to debug some strange warmup behaviors yesterday and I needed to compare two runs (with --count=2) to be able to understand the issue.

More generally, It looks like a nice addition to be able to have one svg output per test.

What is your view on that?

Ben

benjaminrigaud avatar Mar 07 '18 08:03 benjaminrigaud

I think this is a great idea! We could control it with a command-line switch, how does this sound? I'm taking a leaf here from pytest's fixture scoping to control what the output is:

py.test test_foo.py    # combined output
py.test --profile-scope=session  # same as above
py.test --profile-scope=function  # one SVG per function
py.test --profile-scope=module   # one SVG per module 

eeaston avatar Mar 08 '18 13:03 eeaston

The scope parameter idea is really great :+1:

But am not sure we would be able to have the finest granularity with a function scope.

We would need a "call" scope like they imagined in https://github.com/pytest-dev/pytest/issues/2833 that would be a parametrized instance of a test / function.

Does that make sense?

edit: I may have misunderstood the call scope idea and how behave the function scope :)

benjaminrigaud avatar Mar 08 '18 13:03 benjaminrigaud

A module scope would be very useful for @coala , especially if it works without the SVG, i.e. a pstats printout per module.

jayvdb avatar Jun 20 '18 08:06 jayvdb