pytest-cleanslate: work around or find test state pollution
by Juan Altmayer Pizzorno and Emery Berger at UMass Amherst's PLASMA lab.
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.
This module also includes cleanslate-reduce, a tool for finding where the state pollution
is occurring.
Invoked on a test suite with a failing test, cleanslate-reduce looks for a smaller
set of test modules and functions that still lead to the test failure.
How to use
After pip install pytest-cleanslate, simply add --cleanslate to your pytest command line (or configuration options).
Interaction with other plugins
Running with --cleanslate also makes 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.
It also 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.
Metadata
Release files for pytest-cleanslate 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest_cleanslate-1.0.7.tar.gz | 16.8 kB | Without provenance | Details for pytest_cleanslate-1.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_cleanslate-1.0.7-py3-none-any.whl | Python 3 | none | any | Details for pytest_cleanslate-1.0.7-py3-none-any.whl |
Total release size: 30.3 kB
Release files / pytest_cleanslate-1.0.7.tar.gz
| Download URL | pytest_cleanslate-1.0.7.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c730b05b4093027a2108663090f67f1a32f951891250a7869d3402c46b001455
|
|
BLAKE2b-256 checksum How to use checksums |
f1333405c33d68ffd2b5f68d7684af36d03890e1b2e14812f445e6fb8395fccf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / pytest_cleanslate-1.0.7-py3-none-any.whl
| Download URL | pytest_cleanslate-1.0.7-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23a4f95286423be538d35a4e7c4a495d4b6a6fe58fb4d728a009fd53675fca11
|
|
BLAKE2b-256 checksum How to use checksums |
cc43018f3ed8d0e564aac39188f756d146d55e0102502cbd91b43baef677b754
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Security for pytest-cleanslate 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.