pytest-plugins
pytest-plugins copied to clipboard
pytest-profiling: option to include setup/teardown into the output
pytest-profiling
outputs profiles of individual tests and a combined profile of all tests
It seems that setup/teardown is not included in the profile.
I wish there was an option to profile everything, including setup, teardown and fixtures...
Hi there - we just merged #94 which should fix this issue - we'll get a release out very soon, thanks!
Thanks!
I've built from source (tricky!) and as far as I can tell, I can indeed see setup and teardown costs.
Perhaps due to other plugins or project complexity or just the nature of asyncio
the resulting profile is less useful / harder to understand than that made by pytest-profiling==1.6.0
:

The dominant part is just pytest calling pytest and getting back to pytest (via asyncio?).
I reckon that's a subject for another ticket/pr/whatever...
Hi, There is any option to make this fix configurable. I have a situation which i want to profile just the test, without the fixture code itself.
More details: I'm using pypy, so a normal profiling wont be good, pypy requires warmup to detect the hot spots on the code and jit them. I'm using pytest-profiling and pytest-benchmark together, the benchmark plugin have a warmup option and i'm looking for something similar here.
I can implement this on my code (the warmup/setup section) but i need an option to not profile all the pytest code which my test cause to run, and profile just the test itself.
Thank you.
Hi, There is any option to make this fix configurable.
I would be happy to give it a try! Do you have any recommandations @eeaston before I deep dive into the code :male_detective: ?
@benjaminrigaud Hi there (sorry for the super slow reply!!)
The way I'd do this is implement both new and old version of the fix in #94 - as well as add a cmdline switch to control which version to use. So if say --no-profile-fixtures
is passed in, then the code in pytest_runtest_protocol
is a no-op.
I would also be interested in having an option to de/activate fixture time in the profiling!
Is there already something like that available?
Could the help wanted
label be slapped on this issue?
And, perhaps, if maintainers consider that reasonable, good first issue
?