Pytest plugin to validate use of envvars on your tests
Project description
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.
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
Built Distribution
File details
Details for the file pytest-envvars-1.2.1.tar.gz
.
File metadata
- Download URL: pytest-envvars-1.2.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a7dbcc9f1a9cc1ad1ebfa16142588919cdb35763c57157740c0caaadc5185f3 |
|
MD5 | 0f960d482e14aea9c41c965cecda4fee |
|
BLAKE2b-256 | 18bc653c528d5ef5fd4861fbb6eab2e2fb67afa4e7b13960bb5dc65f505f3662 |
File details
Details for the file pytest_envvars-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: pytest_envvars-1.2.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b26c6571af5044c48f06226e0baae3e4d6845a8ea7f0d1893ba4a3992e1756ca |
|
MD5 | 05a1a3a0e31a5c393edec72891591776 |
|
BLAKE2b-256 | cb27c4d6e23f3a9561c94a5fa9eadee482396010638964f999a82fc2d7b5dc39 |