Skip to main content
PyPI version Python versions See Build Status on Travis CI See Build Status on AppVeyor

A simple plugin to ensure the execution of critical sections of code has not been impacted between releases.


Features

  • Parameterisation of profiling parameters

  • Support for all time measurement units

Installation

You can install “pytest-performance” via pip from PyPI:

$ pip install pytest-performance

Usage

  • Default

def my_func(*args, **kwargs):
    return 123

def test_my_func(performance):
    # Check my_func runs within 1 second for 10000 iterations.
    result = performance(my_func)
    assert result == 123
  • Set custom time amount

def my_func(*args, **kwargs):
    return 123

def test_my_func(performance):
    # Check my_func runs within 10 seconds for 10000 iterations.
    result = performance(my_func, target=10)
    assert result == 123
  • Set custom time amount and unit (pint units supported)

def my_func(*args, **kwargs):
    return 123

def test_my_func(performance):
    # Check my_func runs within 1 nanosecond for 10000 iterations.
    result = performance(my_func, target=10, unit='ns')
    assert result == 123
  • Set custom time amount, unit and number of iterations

def my_func(*args, **kwargs):
    return 123

def test_my_func(performance):
    # Check my_func runs within 1 nanosecond for 10 iterations.
    result = performance(my_func, target=10, unit='ns', iterations=10)
    assert result == 123
  • Fixture can be disabled by passing ‘–performance-skip’ to pytest

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT license, “pytest-performance” is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Release files for pytest-performance 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-performance 0.1.0
File Size Uploaded
pytest-performance-0.1.0.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-performance 0.1.0
File Interpreter ABI Platform
pytest_performance-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / pytest-performance-0.1.0.tar.gz

Download URL pytest-performance-0.1.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f7f67c4becf02a1f4d5c1f536cbb61cf66f3d7df46cac78284edcd0a495e0e15
BLAKE2b-256 checksum
How to use checksums
0e3e8037e8c940f993890e78faace9bdf40aa99307fd8da421ff036d0cf7dd7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

Release files / pytest_performance-0.1.0-py3-none-any.whl

Download URL pytest_performance-0.1.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fa546fa98c9fb827495e4f10e6337be3f87272c8a8baf284952209ef8e6ab46
BLAKE2b-256 checksum
How to use checksums
f9d3aa73ae03eabbd6c5bd11a2dd2d091cf6bf5c68bb6416f5288d345c2caf58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page