def test_items(setup_cfg_path):
    updater = ConfigUpdater()
    updater.read(setup_cfg_path)
    sect_names, sects = zip(*updater.items())
    exp_sect_namess = [
        "metadata",
        "options",
        "options.packages.find",
        "options.extras_require",
        "test",
        "tool:pytest",
        "aliases",
        "bdist_wheel",
        "build_sphinx",
        "devpi:upload",
        "flake8",
        "pyscaffold",
    ]
    assert list(sect_names) == exp_sect_namess
    assert all([isinstance(s, Section) for s in sects])

    opt_names, opts = zip(*updater.items("devpi:upload"))
    exp_opt_names = ["no-vcs", "formats"]
    assert list(opt_names) == exp_opt_names
    assert all([isinstance(o, Option) for o in opts])
Ejemplo n.º 2
0
def test_items(setup_cfg_path):
    updater = ConfigUpdater()
    updater.read(setup_cfg_path)
    sect_names, sects = zip(*updater.items())
    exp_sect_namess = [
        'metadata', 'options', 'options.packages.find',
        'options.extras_require', 'test', 'tool:pytest', 'aliases',
        'bdist_wheel', 'build_sphinx', 'devpi:upload', 'flake8', 'pyscaffold'
    ]
    assert list(sect_names) == exp_sect_namess
    assert all([isinstance(s, Section) for s in sects])

    opt_names, opts = zip(*updater.items('devpi:upload'))
    exp_opt_names = ['no-vcs', 'formats']
    assert list(opt_names) == exp_opt_names
    assert all([isinstance(o, Option) for o in opts])
Ejemplo n.º 3
0
def print_ini_updater(ini: ConfigUpdater):
    for section_name, section in list(ini.items())[::-1]:
        print(delimiter)
        print(f'[{section_name}]')
        for name, option in section.items():
            # print(type(option), option)
            print(f'  {option.key} = "{option.value}"')
    print(delimiter)