コード例 #1
0
def test_iterdir_non_recursive(tmpdir):
    path = ArchivePath(
        archive_path=Path('tests', 'requirements', 'dnspython-1.16.0.zip'),
        cache_path=Path(str(tmpdir)),
    )
    paths = [str(subpath) for subpath in path.iterdir(_recursive=False)]
    assert paths == ['dnspython-1.16.0']
コード例 #2
0
def test_iterdir_non_recursive_with_dirs(tmpdir):
    path = ArchivePath(
        archive_path=Path('tests', 'requirements', 'graphviz-0.13.2.zip'),
        cache_path=Path(str(tmpdir)),
    )
    paths = [str(subpath) for subpath in path.iterdir(_recursive=False)]
    assert paths == ['graphviz-0.13.2']
コード例 #3
0
def test_iterdir_non_recursive_tarball(tmpdir):
    path = ArchivePath(
        archive_path=Path('tests', 'requirements', 'sdist.tar.gz'),
        cache_path=Path(str(tmpdir)),
    )
    paths = [str(subpath) for subpath in path.iterdir(_recursive=False)]
    assert paths == ['dephell-0.2.0']
コード例 #4
0
def test_iterdir_non_recursive_wheel(tmpdir):
    path = ArchivePath(
        archive_path=wheel_path,
        cache_path=Path(str(tmpdir)),
    )
    paths = [str(subpath) for subpath in path.iterdir(_recursive=False)]
    assert len(paths) == 2
    assert 'dephell' in paths
    assert 'dephell-0.2.0.dist-info' in paths
コード例 #5
0
def test_iterdir(tmpdir):
    path = ArchivePath(
        archive_path=Path('tests', 'requirements', 'sdist.tar.gz'),
        cache_path=Path(str(tmpdir)),
    )
    paths = [str(subpath) for subpath in path.iterdir(recursive=True)]

    for path in paths:
        assert paths.count(path) == 1, 'duplicate dir: ' + path
    assert 'dephell-0.2.0' in paths
コード例 #6
0
def test_iterdir_recursive_with_dirs(tmpdir):
    path = ArchivePath(
        archive_path=Path('tests', 'requirements', 'graphviz-0.13.2.zip'),
        cache_path=Path(str(tmpdir)),
    )
    paths = [str(subpath) for subpath in path.iterdir(_recursive=True)]

    assert 'graphviz-0.13.2' in paths
    assert str(Path('graphviz-0.13.2', 'setup.py')) in paths
    assert str(Path('graphviz-0.13.2', 'graphviz', '__init__.py')) in paths

    for path in paths:
        assert paths.count(path) == 1, 'duplicate dir: ' + path
コード例 #7
0
def test_iterdir_recursive_tarball(tmpdir):
    path = ArchivePath(
        archive_path=Path('tests', 'requirements', 'sdist.tar.gz'),
        cache_path=Path(str(tmpdir)),
    )
    paths = [str(subpath) for subpath in path.iterdir(_recursive=True)]

    assert 'dephell-0.2.0' in paths
    assert str(Path('dephell-0.2.0', 'setup.py')) in paths
    assert str(Path('dephell-0.2.0', 'dephell', '__init__.py')) in paths

    for path in paths:
        assert paths.count(path) == 1, 'duplicate dir: ' + path
コード例 #8
0
def test_iterdir_recursive_wheel(tmpdir):
    path = ArchivePath(
        archive_path=wheel_path,
        cache_path=Path(str(tmpdir)),
    )
    paths = [str(subpath) for subpath in path.iterdir(_recursive=True)]

    assert 'dephell' in paths
    assert str(Path('dephell', '__init__.py')) in paths
    assert 'dephell-0.2.0.dist-info' in paths
    assert str(Path('dephell-0.2.0.dist-info', 'WHEEL')) in paths

    for path in paths:
        assert paths.count(path) == 1, 'duplicate dir: ' + path
コード例 #9
0
def test_iterdir_recursive(tmpdir):
    path = ArchivePath(
        archive_path=Path('tests', 'requirements', 'dnspython-1.16.0.zip'),
        cache_path=Path(str(tmpdir)),
    )
    paths = [str(subpath) for subpath in path.iterdir(_recursive=True)]

    assert 'dnspython-1.16.0' in paths
    assert str(Path('dnspython-1.16.0', 'setup.py')) in paths
    assert str(Path('dnspython-1.16.0', 'dns', '__init__.py')) in paths
    assert str(Path('dnspython-1.16.0', 'dns', 'rdtypes')) in paths
    assert str(Path('dnspython-1.16.0', 'dns', 'rdtypes', 'ANY')) in paths

    for path in paths:
        assert paths.count(path) == 1, 'duplicate dir: ' + path