Skip to main content

Multtestlib, a package developed for performing unit tests in Python using multiprocessing.

Project description

multtestlib: A package developed for performing unit tests in Python using multiprocessing.

Multtestlib has been devised to aid Python testers in expediting their testing processes through multiprocessing. This approach allows customizable utilization of the computer's available processor cores, facilitating workload distribution and consequent reduction in the overall execution time of the test suite.


GitHub release Python License Downloads

Installation

Multtestlib is available on PyPi and can be installed using the pip command:

pip install multtestlib

Requirements

Multtestlib requires Python 3.7 or later to run.


Usage

For multiprocessing usage, the input parameters of the test functions and their respective expected values must be stored in lists. During the test processing, multtestlib will take care of distributing and managing the data contained in the lists - and functions - among the processor cores indicated in the test program.

Next, we will see an example of a unit test for the myfunction(a, b) being submitted for execution using multiprocessing:

import multtestlib as mtl
import functions

def main():
    cpus = 8 # Specify the number of CPUs to be used.
    input_values1 = []
    input_values2 = []
    return_values = []
	
    # It is necessary to store the input data and
    # expected values in their respective lists.

    mtl.test_equal(cpus, input_values1, input_values2, return_values, functions.myfunction)


if __name__ == "__main__":
    mtl.init()
    main()
    mtl.end()

Output Files

During the execution of the unit tests, three output files are generated containing the results of the tests performed.

filepass.txt -> Contains passed tests
filefail.txt -> Contains failed tests
filetot.txt -> Contains all tests

List of testing commands

table


MIT License

Copyright (c) 2022-2024 Ricardo Ribeiro de Alvarenga

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

multtestlib-1.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

multtestlib-1.0.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file multtestlib-1.0.1.tar.gz.

File metadata

  • Download URL: multtestlib-1.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for multtestlib-1.0.1.tar.gz
Algorithm Hash digest
SHA256 430650c3822a674af583dfc84a0ded15e3cfeed6281924e01a51f608dc844abc
MD5 6f399c34ff58dc05f0c8e5737701004c
BLAKE2b-256 49ff353df8fea7fadd8069ff6bf525eda826a601257460e34b9dbf281d1dc000

See more details on using hashes here.

File details

Details for the file multtestlib-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: multtestlib-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for multtestlib-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24a1dc7b83e552bcaf627a3926a02e98018456306647f2e2345ca058eb900809
MD5 158c7b8ef1a53f29c2745be237b0a50d
BLAKE2b-256 2be2b12761270dda36be0b7178354ad1f48df7fe98a2343981c4ec5292b27d03

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page