Skip to content

eldaduzman/python-perf-unit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-perf-unit

Version License: MIT




python-perf-unit is a Python package designed to enhance unit testing with performance metrics. By integrating with Python's unittest framework, it enables the execution of test methods with performance analysis.

Features

  • Performance Testing: Automatically times unittest test methods.
  • Median Execution Time Assertion: Asserts median execution time of test methods is below a specified threshold.
  • Parallel Execution: Runs tests in parallel using multithreading.
  • Percentile Reporting: Detailed percentile reports for test execution times.

Installation

pip install python-perf-unit

Usage

Decorate your unittest class with @perf_unit_test_class to turn standard unit tests into performance tests.

from perf_unit import perf_unit_test_class
import unittest

@perf_unit_test_class
class MyTestCase(unittest.TestCase):

    def test_example1(self):
        # Your test code here
        pass

    def test_example2(self):
        # Another test code
        pass

if __name__ == '__main__':
    unittest.main()

Code styling

black used for auto-formatting code read,

pylint used for code linting and pep8 compliance read,

mypy used for type hinting read,

About

Decorators and utilities for python performance unit testing

Resources

Stars

2 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages