def test_home_directory():
    test = soc.HomeDirectory('foo.bar')
    result = test()

    # Can't really predict the output, as it's environment-dependent.
    # Just make sure we have something that looks like a path to our file.
    assert result.startswith('/')
    assert result.endswith('foo.bar')
예제 #2
0
def test_directory_modifier():
    file1 = make_temp("""
[mytest]
foo = hello
bar = 123
""")

    source = soc.ConfigFileSource([file1, soc.HomeDirectory('foobar')],
                                  section='mytest')
    config = source.get_config(make_settings())

    assert config.foo == 'hello'
    assert config.bar == 123
    assert config.baz is False
    assert config.happy is None
예제 #3
0
def build_default_sources():
    sources = [
        build_command_line_source(),
        soc.EnvironmentVariableSource(),
        soc.ConfigFileSource((
            '.prospectorrc',
            'setup.cfg',
            'tox.ini',
        )),
        soc.ConfigFileSource((
            soc.ConfigDirectory('.prospectorrc'),
            soc.HomeDirectory('.prospectorrc'),
        ))
    ]

    return sources
예제 #4
0
def build_default_sources():
    sources = [
        build_command_line_source(),
        soc.EnvironmentVariableSource(),
        soc.ConfigFileSource((
            ".prospectorrc",
            "setup.cfg",
            "tox.ini",
        )),
        soc.ConfigFileSource((
            soc.ConfigDirectory(".prospectorrc"),
            soc.HomeDirectory(".prospectorrc"),
        )),
    ]

    return sources