[TIP] Identifying slowest py.test fixtures

André Caron andre.l.caron at gmail.com
Fri Jul 22 09:20:44 PDT 2016


Greetings from Canada :-)

I'm trying to speed up the CI cycle on one project I'm working on and I'm
trying to to figure out where time is spent by the test suite.

I just discovered the excellent --durations option[1] which prints a neat
report containing the slowest tests.

This has been of much help to get started (I've already spotted a few tests
to optimize), but it doesn't seem to track time spent in test fixtures.
I'd like to track metrics for test fixtures, including number of calls,
total time spent in order to optimize the slower fixtures.

I've started reading into the Writing Plugins section[2] and pytest hook
reference[3] to see if I can script my own plug-in for this, but I'm having
a hard time understand if and how I can do this.

Can anyone give me any pointers in how to accomplish this?

Thanks!

André

[1]:
http://docs.pytest.org/en/latest/usage.html#profiling-test-execution-duration
[2]: http://doc.pytest.org/en/latest/writing_plugins.html
[3]:
http://doc.pytest.org/en/latest/writing_plugins.html#pytest-hook-reference
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20160722/0672ecd7/attachment.htm>


More information about the testing-in-python mailing list