New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Using environments with dynaconf_merge causes duplicate list items #668
Comments
Moving the settings.yaml: ---
default:
my_list:
- default_item
env1:
dynaconf_merge: True
my_list:
- env1_item1
- env1_item2 Output:
|
I will add your examples as test cases together with existing tests on https://github.com/rochacbruno/dynaconf/blob/master/tests/test_yaml_loader.py#L428-L493 However I think your first case is the intended behavior, there are cases when user wants to have items duplicated. |
I have the same problem with merging list of sting with last version of dynaconf 3.1.7
2.toml
config.toml
dyn.py
The result is: @rochacbruno is it normal behavior ? |
Hello @ZianVW, I just added a test to reproduce your error, but I'm not being able to, it's passing that way: def test_list_entries_from_yaml_should_not_duplicate_when_merge_True_mark_on_file(tmpdir):
data = {
"default": {
"my_list" : ["default_item"]
},
"other": {"dynaconf_merge": True, "my_list":["other1", "other2"]},
}
yaml_loader.write(str(tmpdir.join("test_settings.yaml")), data)
settings = Dynaconf(
settings_files="test_settings.yaml",
environments=True,
merge_enabled=True,
)
expected_value = BoxList(["default_item", "other1", "other2"])
assert settings.from_env("other").MY_LIST == expected_value Does this test seems to be doing the same thing that you are trying to do? |
For the above test, when I add an assertion: assert settings.MY_LIST == expected_value the value of MY_LIST isn't updated with the others, is this the expected behavior @rochacbruno? E AssertionError: assert <BoxList: ['default_item']> == <BoxList: ['d...1', 'other2']>
E Right contains 2 more items, first extra item: 'other1'
E Full diff:
E - <BoxList: ['default_item', 'other1', 'other2']>
E + <BoxList: ['default_item']> |
I think this is fixed by #810 |
Describe the bug
When I use the layered environments functionality with dynaconf_merge=True, I unexpectedly get repeated list items.
To Reproduce
Steps to reproduce the behavior:
Folder structure does not matter. Attached sample code places all files in a single folder.
dynaconf.zip
Project structure
Config files
/path/.env
and
/path/settings.yaml
Code
/path/src/main.py
Execution
Expected behavior
I expect the following result in settings:
Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: