dynaconf / dynaconf/dynaconf

[RFC] Add FORCE_SETTINGS_FILES to LazySettings.configure() for pytest

Open
#1,077 0 comments 0 reactions 0 assignees View on GitHub
Not a Bug RFC
Dominant language
Python
Stars
4.3k
Forks
347
Avg merge
2d 2h
Merged PRs (30d)
1

Description

I am using DynaConf for loading settings for CLI scripts which are widely distributed. The TOML settings files are located in common configuration paths in the user space such as `~/.config/cli/config.toml` or `~/Library/Application Support/cli/config.toml`.

It is confusing to ask end-users to place their values under a an environment header such as `[default]`. End users will never need different environments. However, when running pytest to test my CLI there is no easy way to override the values of the `settings_files` configuration option.

Similar to how you can add `settings.configure(FORCE_ENV_FOR_DYNACONF="testing")` to force an environment to be used in testing, it would be great to have `SETTINGS.configure(FORCE_SETTINGS_FILES=[path/to/settings.toml])` to override the files that are loaded. This would allow easy creation of multiple configuration files to be used in integration tests.

Maybe there is an easier way to do this, but I haven't found one yet.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.