Coder Social home page Coder Social logo

manycoding / pytest-performance Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rupertcw/pytest-performance

0.0 1.0 0.0 16 KB

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

License: MIT License

Python 100.00%

pytest-performance's Introduction

pytest-performance

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.

pytest-performance's People

Contributors

rupertcw avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.