Skip to content
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

Add test and docs about includes #796

Merged
merged 3 commits into from Sep 3, 2022
Merged

Add test and docs about includes #796

merged 3 commits into from Sep 3, 2022

Conversation

rochacbruno
Copy link
Member

@rochacbruno rochacbruno commented Sep 2, 2022

import os

from dynaconf import Dynaconf

# ISSUE 794
# WHEN USING INCLUDES
# THE INCLUDES ARE LOADED RELATIVE TO
# THE FIRST LOADED FILE `conf/settings.toml`
settings = Dynaconf(
    settings_files=["conf/settings.toml", "conf/.secrets.toml"],
    includes=["**/*.toml"],  # <-- Doesn't start with `conf/`
)

assert settings.a == 3
assert settings.b == 2
assert settings.included_host == "0.0.0.0"
# SO..
# WHEN USING INCLUDES IT IS RECOMMENDED
# TO SET THE ROOT PATH TO THE DIRECTORY
# WHERE THE SCRIPT IS RUNNING
# OR PASS AN ABSOLUTE PATH TO THE root_path or includes

HERE = os.path.dirname(os.path.abspath(__file__))
settings_with_root_path = Dynaconf(
    root_path=HERE,
    settings_files=["conf/settings.toml", "conf/.secrets.toml"],
    includes=["conf/**/*.toml"],
)

assert settings_with_root_path.a == 3
assert settings_with_root_path.b == 2
assert settings_with_root_path.included_host == "0.0.0.0"

closes #794

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2022

Test Results (Python 3.10)

363 tests  ±0   363 ✔️ ±0   34s ⏱️ +2s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ±0 

Results for commit a928113. ± Comparison against base commit eae0773.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2022

Test Results (Python 3.8)

363 tests  ±0   363 ✔️ ±0   31s ⏱️ ±0s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ±0 

Results for commit a928113. ± Comparison against base commit eae0773.

♻️ This comment has been updated with latest results.

@codecov-commenter
Copy link

codecov-commenter commented Sep 2, 2022

Codecov Report

Merging #796 (3183c69) into master (4ef1614) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #796   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         1761      1761           
=========================================
  Hits          1761      1761           
Impacted Files Coverage Δ
dynaconf/base.py 100.00% <100.00%> (ø)

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

@rochacbruno rochacbruno merged commit 3200c00 into master Sep 3, 2022
@rochacbruno rochacbruno deleted the 794 branch September 5, 2022 18:13
rochacbruno added a commit that referenced this pull request Sep 22, 2022
Shortlog of commits since last release:

    Amadou Crookes (1):
          envars.md typo fix (#786)

    Bruno Rocha (19):
          Release version 3.1.9
          Bump dev version to 3.1.10
          Update badges
          demo repo will be replaced by a video tutorial soon
          Fix CI
          New data key casing must adapt to existing key casing (#795)
          Add test and docs about includes (#796)
          Removed vendor_src folder (#798)
          Replacing rochacbruno/ with dynaconf/ (#800)
          Fix codecov (#801)
          Parse negative numbers from envvar Fix #799 and Fix #585 (#802)
          Fix get command with Django (#804)
          Add a functional test runner (#805)
          Test runner docs and styling (#806)
          Allow merge_unique on lists when merge_enabled=True (#810)
          Rebind current env when forced for Pytest Fix #728 (#809)
          AUTO_CAST can be enabled on instance (#811)
          Ensure pyminify is on release script
          Add missing tomllib to monify script

    Gaurav Talreja (1):
          Fix #807 Use client.auth.approle.login instead of client.auth_approle (#808)

    Jitendra Yejare (1):
          Fix #768 of kv property depreciation from client object (#769)

    Joren Retel (2):
          Feature/detect casting comb token from converters (#784)
          Adding documentation and example to makefile. (#791)

    João Gustavo A. Amorim (1):
          Add pyupgrade hook (#759)

    Kian-Meng Ang (1):
          Fix typos (#788)

    Lucas Limeira (1):
          Using filter_strategy in env_loader to fix #760 (#767)

    Nicholas Nadeau, Ph.D., P.Eng (1):
          fix: typo (#766)

    Oleksii Baranov (2):
          Bump codecov action version (#775)
          Fix cli init command for flask (#705) (#774)

    Pedro de Medeiros (1):
          documentation fixes (#771)

    The Gitter Badger (1):
          Add a Gitter chat badge to README.md (#776)

    Théo Melo (1):
          Fixing a typo on the readme file (#763)

    Vicente Marçal (1):
          docs(pt-br): Docs Translation to brazilian portugues. (#787)
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] Includes parameter not working
2 participants