Skip to main content

runs tests in an order such that coverage increases as fast as possible

Project description

pytest_pitch

pytest_pitch runs tests in an order such that coverage increases as fast as possible. Typically 99% of the total coverage is achieved in 10% of the test session time.

example

use as pytest plugin for faster coverage increase

First create persistent time-coverage record via pytest-donde

python -m pytest [YOUR SESSION ARGS] --donde=/path/to/src

where /path/to/src is the code region to cover.

Then pass the record file to the plugin via

python -m pytest [YOUR SESSION ARGS] --pitch

If You change your test definitions or test selection [YOUR SESSION ARGS] in step 2 without updating the record:

  • tests which are unknown to step 1 (e.g. newly defined tests, less strict test selection) will be put to the start of the execution order
  • tests which are known to step 1 but missing in step 2 (e.g. removed tests, stricter test selection) will just be filtered out. Any selection mechanisms should not conflict with the reordering.

use in your script

See this script as a demo which was used to create the image shown above.

background

The plugin employs Algorithm 1 from p. 3 of S. Khuller, A. Moss, J. Naor, The budgeted maximum coverage problem, Inf. Process. Lett. 70, 1999.

install

python -m pip install pytest_pitch

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_pitch-1.0.4.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

pytest_pitch-1.0.4-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file pytest_pitch-1.0.4.tar.gz.

File metadata

  • Download URL: pytest_pitch-1.0.4.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for pytest_pitch-1.0.4.tar.gz
Algorithm Hash digest
SHA256 9ed45bfb890ea33f40b68a3e18afaa4be971ed8207e2fe7cdb11e6d0f7ad614e
MD5 9bdcbdd0ec5508cabfbd0d72e4606670
BLAKE2b-256 19373bdb6c62e2020ef4b43189b1d2513ef045a7b67e370288ccd245cf532d80

See more details on using hashes here.

File details

Details for the file pytest_pitch-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: pytest_pitch-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for pytest_pitch-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 818148fc6a2a21b33f7f82e08a3f52d39170b82fff37576612e04192723d0a4f
MD5 bf2b38f5ab7da59421bb10a832346684
BLAKE2b-256 df905e9767dcf8a8fda1c09d351dedb0263e09debd420e6693f55d880e2e663e

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