Skip to main content

Collects and executes pytest tests separately

Project description

pytest-cleanslate: work around test state pollution

by Juan Altmayer Pizzorno and Emery Berger at UMass Amherst's PLASMA lab.

license pypi pyversions tests Downloads

About

pytest-cleanslate is a small plugin for the pytest test framework which, as the name implies, helps give each test module a "clean slate" to execute. Plugins such as pytest-forked and pytest-isolate allow you to execute tests in separate processes, working around in-memory test "state pollution" resulting from their execution, but do not protect against pollution caused by top-level code in test modules. This is what pytest-CleanSlate remedies.

How to use

After pip install pytest-cleanslate, simply add --cleanslate to your pytest invocation.

Interaction with other plugins

This plugin implies the use of pytest-forked, i.e., it is as though you installed that plugin and passed in --forked to execute all tests in separate processes.

This plugin subverts somewhat pytest's mode of operation in that it postpones collecting test items within test modules (i.e., within Python test files) until the test execution phase. While we have attempted to stay as compatible with other plugins as possible, it is likely to not work in some combinations (such as, for example, pytest-xdist). Feel free to open an issue if you come across a case where it doesn't work.

Requirements

Python 3.8+, Linux or MacOS.

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_cleanslate-1.0.2.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

pytest_cleanslate-1.0.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file pytest_cleanslate-1.0.2.tar.gz.

File metadata

  • Download URL: pytest_cleanslate-1.0.2.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for pytest_cleanslate-1.0.2.tar.gz
Algorithm Hash digest
SHA256 582caa989d4a321f8123d641a10f5aff9134a97f26e76bd7e94c58ebb18ae110
MD5 0c36709b52900ef5ccd640508ac4e78d
BLAKE2b-256 bf0c2a51d4c29bc0c8dca98f878ad5642c92a2f91a5088bb7a93bd941551adfd

See more details on using hashes here.

File details

Details for the file pytest_cleanslate-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_cleanslate-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 adad4371b58c0570b8d15773effc516ce0d9d2de12c8208408fda504af08515e
MD5 233945203c6a10aa921559b5794968f1
BLAKE2b-256 739d473ef92feef21f13fa2bbc897454e8bb3d1133374b78ec8f1c159af1a0d8

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