pytest-dotenv icon indicating copy to clipboard operation
pytest-dotenv copied to clipboard

env_override_existing_values doesn't work if --envfile option is set

Open Krops opened this issue 4 years ago • 2 comments

"override" is hardcoded by True. Suggest to add _override = early_config.getini("env_override_existing_values") to make this configurable

def pytest_sessionstart(session):
    config = session.config
    if config.getoption("envfile", default=None) is not None:
        load_dotenv(dotenv_path=config.getoption("envfile"), override=True)

Krops avatar Nov 11 '20 14:11 Krops

That is currently intentional as the description of this option points out: https://github.com/quiqua/pytest-dotenv/blob/866c90d9475bc469a0e9fc848868af0139658786/pytest_dotenv/plugin.py#L17-L21

Feel free to open a PR and adjust the behaviour accordingly though.

quiqua avatar Nov 11 '20 14:11 quiqua

@quiqua pls check https://github.com/quiqua/pytest-dotenv/pull/21/files

Krops avatar Nov 11 '20 15:11 Krops