Example #1
0
def test_load_from_python_file_not_set():
    """
    Return empty configuration if python file is not defined.

    """
    metadata = Metadata("foo-bar")
    config = load_from_python_file(metadata)
    assert_that(config, is_(empty()))
Example #2
0
def test_load_from_python_file():
    """
    Return configuration from a python file.

    """
    metadata = Metadata("foo-bar")
    with configfile("foo='bar'") as configfile_:
        with envvar("FOO_BAR_SETTINGS", configfile_.name):
            config = load_from_python_file(metadata)
            assert_that(config.foo, is_(equal_to("bar")))