question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document the use of pytest with dynaconf

See original GitHub issue

For testing in my project i want to add in my conftest.py something like that:

import pytest
import os

@pytest.fixture(scope='session', autouse=True)
def settings():
    os.environ['ENV_FOR_DYNACONF'] = 'testing'

But this is not work 😭. What can you advise me ? I dont want start my test like that : ENV_FOR_DYNACONF=testing pytest because somebody can miss that command prefix and mess up some dev data.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
rochacbrunocommented, Aug 8, 2019

I am reopening this issue because I think we should add this to our documentation!

Thank you!

1reaction
rochacbrunocommented, Feb 6, 2020

@gabicavalcante I updated the PR and made dynaconf.settings to be always inded to app.config so you can use both and this confusion will not happen again, thanks for the insight.

@thomaszdxsn I think the PR also solves the Django problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Document the use of pytest with dynaconf · Issue #203 - GitHub
For testing in my project i want to add in my conftest.py something like that: import pytest import os @pytest.fixture(scope='session', ...
Read more >
Testing — dynaconf 2.2.3 documentation - Read the Docs
For pytest it is common to create fixtures to provide pre-configured settings object or to configure the settings before all the tests are...
Read more >
Advanced usage - Dynaconf - 3.1.11
Programmatically loading a settings file¶. from dynaconf import settings settings.load_file ...
Read more >
How to Write a Configuration file in Python - The Tech Platform
Which format of the configuration file should I use? ... import pytest from dynaconf import settings @pytest.fixture(scope="session", ...
Read more >
validate yaml file with dynaconf or schema in python
... "app.args.arg3", must_exist=True, ), ] @pytest.fixture def yaml_validators_bad(): return [ Validator("missing.value", must_exist=True), ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found