Skip to main content

Multi core processing of unittests

Project description

pypi python version(s) pypi implementation pypi development status pypi latest version pypi downloads per month tested on which operating systems

A Python library/application for running unittests in parallel and merging results.

Installation

To install the latest release from PyPI, simply run:

pip install mpunittest

Or to install the latest development version, run:

git clone https://github.com/maximilianpilz/mpunittest
python -m pip install .

Quick Start

An example for running with 10 workers and generating an html file containing the results:

merging_runner = mpunittest.runner.MergingRunner(process_count=10)

merging_runner.discover_and_run(
    start_dir=pathlib.Path('path_to_search_in').resolve(),
    pattern="*.py",
    html_result_assets=mpunittest.runner.HtmlResultAssets(
        document_title='title of the html',
        document_file_name='name_of_the_html_file',
        result_path='unittest_results'
    )
)

An example for running with 10 workers and without any files being generated:

merging_runner = mpunittest.runner.MergingRunner(process_count=10)

result = merging_runner.discover_and_run(
    start_dir=pathlib.Path('path_to_search_in').resolve(),
    pattern="*.py"
)

print(result)

An example for turning on logging:

handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
handler.setLevel(logging.INFO)
mpunittest.logging.logger.addHandler(handler)

# run tests here

mpunittest.logging.logger.getChild('your.script').info('result: %s', result)

An example for running without writing additional python code:

python -m mpunittest.run /Users/yourname/dev/python_projects/yourproject/src/tests -p "test*.py" -da -c 4

To see the help for running without writing additional python code:

python -m mpunittest.run --help

Licensing

Copyright (C) 2023 Maximilian Pilz

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

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

mpunittest-0.0.0a5.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

mpunittest-0.0.0a5-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file mpunittest-0.0.0a5.tar.gz.

File metadata

  • Download URL: mpunittest-0.0.0a5.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for mpunittest-0.0.0a5.tar.gz
Algorithm Hash digest
SHA256 a2ee8aad6b2598d939031f0faf4c7536ddbca6d09bf7fed487f81691475b77ef
MD5 ad0204003177814ce05b2e0d43d84543
BLAKE2b-256 a235751aa34fa6b48065bf1b67ef1d4ce89cc50d14845a05533ad7f670b8fd45

See more details on using hashes here.

File details

Details for the file mpunittest-0.0.0a5-py3-none-any.whl.

File metadata

  • Download URL: mpunittest-0.0.0a5-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for mpunittest-0.0.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 3150bbf4e3608c517f3231c22f2280ebff19f762962947011eb76ebc14bfedfa
MD5 379e65d8d43bea030b9ceb6ab3f0cd72
BLAKE2b-256 91565428d7079c7db7f42a6d798770b6a50c849d8c995fdcbb9551e16de76aac

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