Skip to content

fix(set): non-str key raising type error #1005#1008

Merged
rochacbruno merged 5 commits intodynaconf:masterfrom
pedro-psb:fix/non-str-type-error
Sep 28, 2023
Merged

fix(set): non-str key raising type error #1005#1008
rochacbruno merged 5 commits intodynaconf:masterfrom
pedro-psb:fix/non-str-type-error

Conversation

@pedro-psb
Copy link
Copy Markdown
Member

@pedro-psb pedro-psb commented Sep 25, 2023

Overview

There are some internal functions that expect only string keys and are called just in specific program flows, such as the one reported #1005.

In this case, the reported setup would trigger find_the_correct_casing, which didn't have a non-str treatment yet.

This specific setup was:

  • merge enabled
  • two nested levels
  • both non-str with str keys present in the container being merged

@netlify
Copy link
Copy Markdown

netlify bot commented Sep 25, 2023

Deploy Preview for dynaconf ready!

Name Link
🔨 Latest commit eebbe48
🔍 Latest deploy log https://app.netlify.com/sites/dynaconf/deploys/65155321e4260400080379c7
😎 Deploy Preview https://deploy-preview-1008--dynaconf.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

def test_set_with_non_str_types():
"""This replicates issue #1005 in a simplified setup."""
settings = Dynaconf(merge_enabled=True)
settings.set("a", {"b": {1: "foo"}})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test case must cover the higher levels of the structure also

settings.set(1, {"b": {1: "foo"}})
tings.set("a", {"1": {1: "foo"}})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can take the example provided on #1005 and add as a test_functional/issues/

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 25, 2023

Codecov Report

Merging #1008 (eebbe48) into master (9170beb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1008   +/-   ##
=======================================
  Coverage   98.70%   98.70%           
=======================================
  Files          23       23           
  Lines        2242     2247    +5     
=======================================
+ Hits         2213     2218    +5     
  Misses         29       29           
Files Coverage Δ
dynaconf/base.py 99.62% <100.00%> (+<0.01%) ⬆️
dynaconf/utils/__init__.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sebastian-correa
Copy link
Copy Markdown
Collaborator

Hey @pedro-psb just popping in to thank you for your work on this issue! Sorry I couldn't tackle it though, in all honesty, I would've never been able to make this fix with the time I've had these past weeks. I'll keep an eye out for this release!

@rochacbruno rochacbruno merged commit 4ed2350 into dynaconf:master Sep 28, 2023
@pedro-psb pedro-psb deleted the fix/non-str-type-error branch September 28, 2023 15:40
pedro-psb added a commit to pedro-psb/dynaconf that referenced this pull request Oct 31, 2023
Shortlog of commit since last release:

    Bruno Rocha (2):
          Release version 3.2.3
          fix(env): allow underscore in env name dynaconf#1011 (dynaconf#1015)

    Jake Callahan (1):
          fix(vault): pin hvac minimum version

    Pedro Pessoa (3):
          fix(set): non-str key raising type error dynaconf#1005 (dynaconf#1008)
          fix(merge): dynaconf_merge=False on nested structures (dynaconf#1012)
          fix(cli): support for 'entrypoint-path' in FLASK_APP dynaconf#946 (dynaconf#1014)

    Sebastian Correa (1):
          doc(validation): Improve Configuration and Validation sections of the docs (dynaconf#989)

    Vladislav Sharapov (1):
          doc(envvars): Fix link to configuration page (dynaconf#1020)
pedro-psb added a commit to pedro-psb/dynaconf that referenced this pull request Nov 19, 2023
Shortlog of commit since last release:

    Bruno Rocha (2):
          Release version 3.2.3
          fix(env): allow underscore in env name dynaconf#1011 (dynaconf#1015)

    Jake Callahan (1):
          fix(vault): pin hvac minimum version

    Pedro Pessoa (3):
          fix(set): non-str key raising type error dynaconf#1005 (dynaconf#1008)
          fix(merge): dynaconf_merge=False on nested structures (dynaconf#1012)
          fix(cli): support for 'entrypoint-path' in FLASK_APP dynaconf#946 (dynaconf#1014)

    Sebastian Correa (1):
          doc(validation): Improve Configuration and Validation sections of the docs (dynaconf#989)

    Vladislav Sharapov (1):
          doc(envvars): Fix link to configuration page (dynaconf#1020)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] BoxKeyError: "dynaconf_merge_unique" with specific YAML files

3 participants