Ejemplo n.º 1
0
def test_extras():
    info = inifile.read_flit_config(osp.join(samples_dir, 'extras.toml'))
    requires_dist = set(info.metadata['requires_dist'])
    assert requires_dist == {
        'toml',
        'pytest ; extra == "test"',
        'requests ; extra == "custom"',
    }
    assert set(info.metadata['provides_extra']) == {'test', 'custom'}
Ejemplo n.º 2
0
def test_requires_with_empty_lines():
    ini_info = inifile.read_flit_config(
        osp.join(samples_dir, 'requires_with_empty_lines.ini')
    )
    assert ini_info.metadata['requires_dist'] == ['foo', 'bar']
Ejemplo n.º 3
0
def test_requires_extra_env_marker():
    info = inifile.read_flit_config(osp.join(samples_dir, 'requires-extra-envmark.toml'))
    assert info.metadata['requires_dist'][0].startswith('pathlib2 ;')
Ejemplo n.º 4
0
def test_extras_dev_warning(caplog):
    info = inifile.read_flit_config(osp.join(samples_dir, 'requires-dev.toml'))
    assert '"dev-requires = ..." is obsolete' in caplog.text
    assert set(info.metadata['requires_dist']) == {'apackage ; extra == "dev"'}
Ejemplo n.º 5
0
def test_extras_dev_conflict():
    with pytest.raises(inifile.ConfigError, match=r'dev-requires'):
        inifile.read_flit_config(osp.join(samples_dir, 'extras-dev-conflict.toml'))
Ejemplo n.º 6
0
def test_bad_description_extension(caplog):
    info = inifile.read_flit_config(osp.join(samples_dir, 'bad-description-ext.toml'))
    assert info.metadata['description_content_type'] is None
    assert any((r.levelno == logging.WARN and "Unknown extension" in r.msg)
                for r in caplog.records)
Ejemplo n.º 7
0
def test_missing_description_file():
    with pytest.raises(inifile.ConfigError, match=r"Description file .* does not exist"):
        inifile.read_flit_config(osp.join(samples_dir, 'missing-description-file.toml'))
Ejemplo n.º 8
0
def test_description_file():
    info = inifile.read_flit_config(osp.join(samples_dir, 'package1-pkg.ini'))
    assert info.metadata['description'] == \
        "Sample description for test.\n"
    assert info.metadata['description_content_type'] == 'text/x-rst'
Ejemplo n.º 9
0
def test_misspelled_key():
    with pytest.raises(inifile.ConfigError) as e_info:
        inifile.read_flit_config(osp.join(samples_dir, 'misspelled-key.ini'))

    assert 'description-file' in str(e_info.value)
Ejemplo n.º 10
0
def test_load_toml():
    inf = inifile.read_flit_config(osp.join(samples_dir, 'module1-pkg.toml'))
    assert inf.module == 'module1'
    assert inf.metadata['home_page'] == 'http://github.com/sirrobin/module1'
Ejemplo n.º 11
0
def test_missing_entrypoints():
    with pytest.raises(inifile.ConfigError, match="does not exist"):
        inifile.read_flit_config(osp.join(samples_dir, 'entrypoints_missing.ini'))