Skip to main content

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

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-performance-0.1.0.tar.gz (4.4 kB view hashes)

Uploaded source

Built Distribution

pytest_performance-0.1.0-py3-none-any.whl (4.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page