You can test your code using config_override in your tests to test various configuration values.

For example:

# testdebug.py

Minimal example showing how to override configuration values when testing.

import unittest

from everett.manager import ConfigManager, config_override

class App:
    def __init__(self):
        config = ConfigManager.basic_config()
        self.debug = config("debug", default="False", parser=bool)

class TestDebug(unittest.TestCase):
    def test_debug_on(self):
        with config_override(DEBUG="on"):
            app = App()

    def test_debug_off(self):
        with config_override(DEBUG="off"):
            app = App()

if __name__ == "__main__":
everett.manager.config_override(**cfg) → everett.manager.ConfigOverride

Allow you to override config for writing tests.

This can be used as a class decorator:

@config_override(FOO="bar", BAZ="bat")
class FooTestClass(object):

This can be used as a function decorator:

def test_foo():

This can also be used as a context manager:

def test_foo():
    with config_override(FOO="bar"):