{"library":"pytest-durations","title":"Pytest Durations","description":"pytest-durations is an active pytest plugin, currently at version 1.6.2, designed to report detailed execution times for both test functions and their associated fixtures. Unlike pytest's built-in `--durations` feature, it separates these timings and offers compatibility with distributed testing frameworks like pytest-xdist and time-traveling packages. The library sees frequent updates, with multiple minor and patch releases occurring throughout the year.","language":"python","status":"active","last_verified":"Sat Apr 11","install":{"commands":["pip install pytest-durations"],"cli":{"name":"pytest","version":"pytest 9.0.3"}},"imports":[],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pytest\nimport time\n\ndef test_fast_example():\n    time.sleep(0.01)\n    assert True\n\ndef test_slow_example_with_fixture(my_fixture):\n    time.sleep(0.05)\n    assert my_fixture == \"setup_done\"\n\n@pytest.fixture\ndef my_fixture():\n    time.sleep(0.02)\n    yield \"setup_done\"\n    time.sleep(0.01)\n\n# To run: Save the above as test_durations.py and run 'pytest --pytest-durations=5' in the terminal.","lang":"python","description":"To use pytest-durations, simply install the plugin. It integrates automatically with pytest. Create a test file, then run pytest with the `--pytest-durations=N` option to show the N slowest durations. You can also specify `--pytest-durations-log=FILE` to output results to a file.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}