Exemplo n.º 1
0
def test_subdir_absolute_path(tmpdir):
    tmpdir.mkdir('sub1').join('a.json').write('')
    tmpdir.mkdir('sub2').join('b.json').write('')
    spec = [('my/target', str(tmpdir.join('sub1')), '**/*.json')]
    res = get_data_files(spec, top=str(tmpdir))
    assert sorted(res) == [
        ('my/target', ['sub1/a.json']),
    ]
Exemplo n.º 2
0
def test_nested_source_dir(tmpdir):
    maindir = tmpdir.mkdir('main')
    maindir.mkdir('sub1').join('a.json').write('')
    maindir.mkdir('sub2').join('b.json').write('')
    spec = [('my/target', 'main/sub1', 'a.json')]
    res = get_data_files(spec, top=str(tmpdir))
    assert sorted(res) == [
        ('my/target', ['main/sub1/a.json']),
    ]
Exemplo n.º 3
0
def test_empty_relative_path(tmpdir):
    tmpdir.mkdir('sub1').join('a.json').write('')
    tmpdir.mkdir('sub2').join('b.json').write('')
    spec = [('my/target', '', '**/*.json')]
    res = get_data_files(spec, top=str(tmpdir))
    assert sorted(res) == [
        ('my/target/sub1', ['sub1/a.json']),
        ('my/target/sub2', ['sub2/b.json']),
    ]
Exemplo n.º 4
0
def test_relative_trailing_slash(tmpdir):
    maindir = tmpdir.mkdir('main')
    maindir.mkdir('sub1').join('a.json').write('')
    maindir.mkdir('sub2').join('b.json').write('')
    spec = [('my/target/', 'main/', '**/*.json')]
    res = get_data_files(spec, top=str(tmpdir))
    assert sorted(res) == [
        ('my/target/sub1', ['main/sub1/a.json']),
        ('my/target/sub2', ['main/sub2/b.json']),
    ]