Pytest plugin to validate use of envvars on your tests
What is pytest-envvars?
pytest-envvars randomize values of environment variables on your unit tests to check consistency of mocks about configuration. If the test has a wrong mock, this test will be broken.
Install
$ pip install pytest-envvars
Use
You need write some changes on pytest.ini file, like that…
[pytest]
pytestenvvars__env_files =
.env
pytestenvvars__dont_randomize_envvars =
CACHE_URL
On this example above the plugin read .env file (from pytestenvvars__env_files section) of your project and randomize ALL envvar configuration on that file, if you dont need randomize some envvar configuration you need add this envvar to pytestenvvars__dont_randomize_envvars section like shown above.
Before that configuration to run validation you need run pytest with flag --validate-envvars, like that…
pytest --validate-envvars
To debug purpose you can use --envvars-value to set a default value for all envvars. This parameter accept only two options 0 or 1, see this example:
pytest --validate-envvars --envvars-value=0
Using the plugin that way you will apply the value 0 to ALL of your envvars.
Metadata
Release files for pytest-envvars 1.2.1
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-envvars-1.2.1.tar.gz | 6.6 kB | Without provenance | Details for pytest-envvars-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_envvars-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for pytest_envvars-1.2.1-py3-none-any.whl |
Total release size: 13.2 kB
Release files / pytest-envvars-1.2.1.tar.gz
| Download URL | pytest-envvars-1.2.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a7dbcc9f1a9cc1ad1ebfa16142588919cdb35763c57157740c0caaadc5185f3
|
|
BLAKE2b-256 checksum How to use checksums |
18bc653c528d5ef5fd4861fbb6eab2e2fb67afa4e7b13960bb5dc65f505f3662
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
|
Release files / pytest_envvars-1.2.1-py3-none-any.whl
| Download URL | pytest_envvars-1.2.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b26c6571af5044c48f06226e0baae3e4d6845a8ea7f0d1893ba4a3992e1756ca
|
|
BLAKE2b-256 checksum How to use checksums |
cb27c4d6e23f3a9561c94a5fa9eadee482396010638964f999a82fc2d7b5dc39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
|
Security for pytest-envvars 1.2.1
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.