Beispiel #1
0
def test_set_default_dependency_settings_override():
    sample = SampleClassTwo()
    class LocalConfig(Configuration):
        FirstDependency = "Hola"
    apply_configs(LocalConfig)
    assert sample.dep1 == "Hola"
    clear_config()
Beispiel #2
0
def test_dependency_instance():
    class LocalConfig(Configuration):
        FirstDependency = Instance(class_path(FakeClass))

    apply_configs(LocalConfig)
    sample = SampleClass()
    dep1 = get_dependency('FirstDependency')
    assert id(dep1) == id(sample.dep1)
    clear_config()
Beispiel #3
0
def test_set_dependencies_through_apply_configs():
    class LocalConfig(Configuration):
        FirstDependency = "Hello"
        SecondDependency = "World"
    apply_configs(LocalConfig)
    sample = SampleClass()
    assert sample.dep1 == "Hello"
    assert sample.dep2 == "World"
    clear_config()
Beispiel #4
0
def test_dependency_import():
    class LocalConfig(Configuration):
        FirstDependency = Import(class_path(FakeClass))

    apply_configs(LocalConfig)
    sample = SampleClass()
    dep1 = get_dependency('FirstDependency')
    assert dep1 == FakeClass
    assert sample.dep1 == FakeClass