Ejemplo n.º 1
0
def test_config_read_from_argument():
    argv = "-f test2.cfg".split()
    parser = configuration.CmdlineParser()
    options = configuration.Configuration()

    assert options.interactive is False
    parser.parse(argv)
    assert 'test2.cfg' in options.cfg_files, options.cfg_files
    assert options.interactive is True
    options.interactive = False
    assert options.interactive is False
Ejemplo n.º 2
0
def test_config_and_parser():
    options = configuration.Configuration()
    assert options.pattern == 'default-pattern', options.pattern
    assert options.dryrun is False
    assert options.move is False
    assert options.target_dir == './bla'

    parser = configuration.CmdlineParser()
    argv = "-nm -p multi file".split()
    files = parser.parse(argv)

    assert options.pattern == 'multi'
    assert options.dryrun is True
    assert options.move is True
    assert files == ['file']

    argv = "-c -p internal".split()
    files = parser.parse(argv)

    assert options.pattern == 'default-pattern'
    assert options.dryrun is True  # options not changed by argv
    assert options.move is False  # option changed by argv
    assert files == []
Ejemplo n.º 3
0
def parser_created(step):
    world.parser = configuration.CmdlineParser()
Ejemplo n.º 4
0
def parser_after_changing_configuration_options(step):
    conf = configuration.Configuration()
    conf.interactive = True
    world.sth = True
    world.parser = configuration.CmdlineParser()
Ejemplo n.º 5
0
from ArrangeMusic import configuration, tools
import sys

if __name__ == '__main__':
    if len(sys.argv) < 2:
        configuration.CmdlineParser().help()
    else:
        argv = sys.argv[1:]
        configuration.CmdlineParser().parse(argv)
        tools.print_overview()