pytest-dotenv
pytest-dotenv copied to clipboard
Fix issue if overide option is disabled envfile option overides witho…
…ut checking
@quiqua
Hej! Sorry for the late response.
I've some questions for the integration of this PR.
Currently the flow of the plugin is:
- You can specify some env files that are loaded when the tests are started via the pytest configuration file(s) Those options include to specify if existing values should be overridden.
- Additionally you can pass the runtime parameter
--env-file
to your tests, that will explicitly use all the values defined in that file.
What is the benefit of using the enable or disable that existing values will be overridden, when the runtime parameter is set?
Lets say I have the following setup:
-
pytest.ini
[pytest] env_files = .default-test-values
-
.default-test-values
FOO=bar SPAM=egg
Now if I want to use additionally a env file passed via the CLI --env-file=.override-values
, then I could just specify the values that I want to replace:
SPAM=baz
This will result in the following env variables when the tests are executed:
FOO=bar
SPAM=baz
Could you elaborate, why it might be useful to not overwrite the values?