Skip to main content

Pytest plugin to validate use of envvars on your tests

Project description

See Build Status on Travis CI

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

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-envvars-1.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_envvars-1.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file pytest-envvars-1.1.0.tar.gz.

File metadata

  • Download URL: pytest-envvars-1.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for pytest-envvars-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1a6b365e70d55886bee4b3e90413982fba50b5c83d5c0ed37984e2caa5c50374
MD5 3ef997ad5c76a3cee9b0254347a4685b
BLAKE2b-256 8cc4bb9b61e66fd37c7249f755ab32cc407ff6e3fff093ef5a03af57e1d37047

See more details on using hashes here.

File details

Details for the file pytest_envvars-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_envvars-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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/46.3.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for pytest_envvars-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f067aa8370468b5f00ef5bbc4035ced3ad1720c4091f3c971978170086959382
MD5 06dbd6148c911cbdc096b3c4afcba5bd
BLAKE2b-256 2c1f4076858f0ffd930fe78acb060cefdb252bd4613d69d5b2b48024ac1d7bfb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page