Skip to content

jaraco/pytest-perf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

affe29e · Nov 2, 2024
Oct 28, 2024
Sep 11, 2024
Jun 14, 2024
Aug 8, 2024
Jun 16, 2022
Oct 25, 2024
May 31, 2024
Apr 11, 2023
May 20, 2024
Feb 7, 2024
Jun 27, 2021
Aug 29, 2024
Oct 29, 2024
Mar 31, 2024
Nov 2, 2024
Jun 21, 2023
Sep 11, 2024

Repository files navigation

tests Ruff https://img.shields.io/badge/skeleton-2024-informational

Run performance tests against the mainline code.

Usage

To use it, include pytest-perf in the test dependencies for your project, then create some Python module in your package. The plugin will include any module that contains the text "pytest_perf" and will run performance tests on each function containing "perf" in the name.

Tests don't execute the module directly, but instead parse out the code of the function in two parts, the warmup and the test, separated by a "# end warmup" comment, and then passes those to the timeit module.

See the exercises.py module for example usage.

Design

pytest-perf works by creating two installs, the control and the experiment, and measuring the performance of some python code against each.

Under the hood, it uses pip-run to install from the upstream main branch (e.g. https://github.com/jaraco/pytest-perf) for the control and from . for the experiment. It then runs each of the experiments against each of the enviroments.