Need help with pytest-env?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

MobileDynasty
132 Stars 17 Forks MIT License 11 Commits 9 Opened issues

Description

pytest plugin used to set environment variables

Services available

!
?

Need anything else?

Contributors list

pytest-env

This is a py.test plugin that enables you to set environment variables in the pytest.ini file.

Installation

Install with pip:

pip install pytest-env

Uninstall with pip:

pip uninstall pytest-env

Usage

In your pytest.ini file add a key value pair with

env
as the key and the environment variables as a line separated list of
KEY=VALUE
entries. The defined variables will be added to the environment before any tests are run:
[pytest]
env =
    HOME=~/tmp
    RUN_ENV=test

You can use

D:
(default) as prefix if you don't want to override existing environment variables:
[pytest]
env =
    D:HOME=~/tmp
    D:RUN_ENV=test

Lastly, you can use existing environment variables using a python-like format:

[pytest]
env =
    RUN_PATH=/run/path/{USER}

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.