question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pytest-profiling: option to include setup/teardown into the output

See original GitHub issue

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…

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
eeastoncommented, Nov 19, 2021

@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.

1reaction
kosh-bcommented, Oct 21, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pytest-profiling - PyPI
Profiling plugin for pytest, with tabular and heat graph output. Tests are profiled with cProfile and analysed with pstats; heat graphs are generated...
Read more >
pytest fixtures: explicit, modular, scalable
pytest fixtures offer dramatic improvements over the classic xUnit style of setup/teardown functions: fixtures have explicit names and are activated by ...
Read more >
How do I correctly setup and teardown for my pytest class with ...
According to Fixture finalization / executing teardown code, the current best practice for setup and teardown is to use yield instead of return...
Read more >
Profiling and improving the runtime of a large pytest test suite
Database setup and tear down. The final optimization I applied had to do with the way we use databases in the test suite....
Read more >
pytest-profiling - Python Package Health Analysis - Snyk
Profiling plugin for py.test For more information about how to use this package see ... Snyk scans all the packages in your projects...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found