pytest-modified-env
Pytest plugin to fail a test if it leaves modified os.environ afterwards.
Example:
import os
def test_that_modifies_env() -> None:
os.environ['CUSTOM_ENV'] = '1'
With pytest-modified-env plugin installed, this test will fail:
___________________________ test_that_modifies_env ____________________________
test_that_modifies_env:4: in pytest_runtest_call
E RuntimeError: os.environ was changed
Because it adds CUSTOM_ENV inside a test and does not clean it up.
In theory it can affect other tests and tests should be isolated!
Installation
pip install pytest-modified-env
Extras
In some cases test still might modify the env in this way. But, it needs an explicit approval for that:
import os
import pytest
@pytest.mark.modify_env()
def test_that_modifies_env() -> None:
os.environ['CUSTOM_ENV'] = '1'
This test won't fail, eventhough it adds CUSTOM_ENV,
because it has modifies_env marker.
License
Metadata
Release files for pytest-modified-env 0.1.0
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-modified-env-0.1.0.tar.gz | 3.6 kB | Without provenance | Details for pytest-modified-env-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_modified_env-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pytest_modified_env-0.1.0-py3-none-any.whl |
Total release size: 7.7 kB
Release files / pytest-modified-env-0.1.0.tar.gz
| Download URL | pytest-modified-env-0.1.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c468d77643759e3b542bf173449b008a7d99883951ac7202ebbf836209f8cf43
|
|
BLAKE2b-256 checksum How to use checksums |
58de5c1a684b1aef8edd35397e1fe9985c499a2568a4ea74ab60ad486d9e9b23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.9.9 Darwin/18.7.0
|
Release files / pytest_modified_env-0.1.0-py3-none-any.whl
| Download URL | pytest_modified_env-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3092011855f767b2e0e6c36e92a07c72f2de1426406a9c8224c955525dbb0a9
|
|
BLAKE2b-256 checksum How to use checksums |
1d2cfa83085736b6761bf6666f9d4f965a7d6c15575683589ce08044926a274a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.9.9 Darwin/18.7.0
|
Security for pytest-modified-env 0.1.0
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.