Repository: rochacbruno/dynaconf
Pull request #357 (2020-06-16 16:15:12)

Lowecase read allowed by default

codecov[bot]: # [Codecov](https://codecov.io/gh/rochacbruno/dynaconf/pull/357?src=pr&el=h1) Report
> Merging [#357](https://codecov.io/gh/rochacbruno/dynaconf/pull/357?src=pr&el=desc) into [master](https://codecov.io/gh/rochacbruno/dynaconf/commit/fe19d5e2a4a51375efcbf8c80a68150d61637181&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/rochacbruno/dynaconf/pull/357/graphs/tree.svg?width=650&height=150&src=pr&token=GXszVzJcqW)](https://codecov.io/gh/rochacbruno/dynaconf/pull/357?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##            master      #357   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines          813       813           
=========================================
  Hits           813       813           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/rochacbruno/dynaconf/pull/357?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/rochacbruno/dynaconf/pull/357?src=pr&el=footer). Last update [fe19d5e...2b97954](https://codecov.io/gh/rochacbruno/dynaconf/pull/357?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/docs/guides/configuration.md b/docs/guides/configuration.md
index f60c94c..a2e06fe 100644
--- a/docs/guides/configuration.md
+++ b/docs/guides/configuration.md
@@ -49,7 +49,7 @@ It can also be passed as parameters to extensions like `FlaskDynaconf` or set in
     INCLUDES | list | A list of paths or a glob to load can be a toml-like list, or sep by , or ; | [] | INCLUDES_FOR_DYNACONF=”[‘path1.ext’, ‘folder/*’]” INCLUDES_FOR_DYNACONF=”path1.toml;path2.toml” INCLUDES_FOR_DYNACONF=”path1.toml,path2.toml” INCLUDES_FOR_DYNACONF=”single_path.toml” INCLUDES_FOR_DYNACONF=”single_path/glob/.toml”
     INSTANCE **used only by** *$dynaconf** *cli*. | str | Custom instance of LazySettings Must be an importable Python module. | None | INSTANCE_FOR_DYNACONF=myapp.settings
     LOADERS | list | A list of enabled external loaders. |	[‘dynaconf.loaders.env_loader’] | LOADERS_FOR_DYNACONF=’[‘module.mycustomloader’, …]’
-    LOWERCASE_READ | bool | If True first level keys can be accessed via lower case attrs |	False | LOWERCASE_READ_FOR_DYNACONF=true
+    LOWERCASE_READ | bool | If False first level keys cannot be accessed via lower case attrs |	True | LOWERCASE_READ_FOR_DYNACONF=false
     MERGE_ENABLED | bool | A bool to activate the global merge feature | False | MERGE_ENABLED_FOR_DYNACONF=1
     NESTED_SEPARATOR | str | Separator for nested assignment like `export DYNACONF_DATABASES__NAME='foo'` | `__` double underline | NESTED_SEPARATOR_FOR_DYNACONF='___'
     PRELOAD | list | A list of paths or glob to be pre-loaded before main settings file. | [] | PRELOAD_FOR_DYNACONF="['path1.ext', 'folder/*']"
diff --git a/dynaconf/default_settings.py b/dynaconf/default_settings.py
index b31ea7b..ced7d2e 100644
--- a/dynaconf/default_settings.py
+++ b/dynaconf/default_settings.py
@@ -96,7 +96,7 @@ SETTINGS_FILE_FOR_DYNACONF = get("SETTINGS_FILE_FOR_DYNACONF", default_paths)
 ENVLESS_MODE_FOR_DYNACONF = get("ENVLESSMODE_FOR_DYNACONF", False)
 
 # If True dynaconf will allow access to first level settngs in lower case
-LOWERCASE_READ_FOR_DYNACONF = get("LOWERCASE_READ_FOR_DYNACONF", False)
+LOWERCASE_READ_FOR_DYNACONF = get("LOWERCASE_READ_FOR_DYNACONF", True)
 
 # The environment variable to switch current env
 ENV_SWITCHER_FOR_DYNACONF = get(


Test patch:
diff --git a/tests/test_base.py b/tests/test_base.py
index ae1ef4b..7d1301b 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -18,12 +18,16 @@ def test_deleted_raise(settings):
     assert settings.get("TODELETE") is None
 
 
-def test_accepts_only_upper(settings):
-    """Only upper case names are allowed
+def test_accepts_only_upper():
+    """Only upper case names are allowed if lowercase_read=False
     lower case are converted"""
+
+    settings = LazySettings(debug=True, lowercase_read=False)
+
     assert settings.DEBUG is True
     assert settings.get("debug") is True
     assert settings.get("DEBUG") is True
+    assert settings.get("Debug") is True
     assert settings.exists("debug")
     with pytest.raises(AttributeError):
         # access in lower case is not allowed
@@ -794,6 +798,9 @@ def test_envless_mode(tmpdir):
 
 
 def test_lowercase_read_mode(tmpdir):
+    """
+    Starting on 3.0.0 lowercase keys are enabled by default
+    """
     data = {
         "foo": "bar",
         "hello": "world",
@@ -802,7 +809,7 @@ def test_lowercase_read_mode(tmpdir):
     }
     toml_loader.write(str(tmpdir.join("settings.toml")), data)
 
-    settings = LazySettings(ENVLESS_MODE=True, lowercase_read=True)
+    settings = LazySettings(ENVLESS_MODE=True)
 
     assert settings.FOO == "bar"
     assert settings.foo == "bar"