def test_get_options(setup_cfg_path):
    updater = ConfigUpdater()
    updater.read(setup_cfg_path)
    options = updater.options('options.packages.find')
    exp_options = ['where', 'exclude']
    assert options == exp_options
    with pytest.raises(NoSectionError):
        updater.options("non_existent_section")
Beispiel #2
0
def test_get_options(setup_cfg_path):
    updater = ConfigUpdater()
    updater.read(setup_cfg_path)
    options = updater.options("options.packages.find")
    exp_options = ["where", "exclude"]
    assert options == exp_options
    with pytest.raises(NoSectionError):
        updater.options("non_existent_section")

    # Section objects also have a "get" method similar to dict
    section = updater["metadata"]
    assert section.get("name").value == "configupdater"
    assert section.get("non_existent_option") is None
    assert section.get("non_existent_option", []) == []