Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Apr 2, 2024
1 parent f9e7db6 commit bf4c8c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/conda_package_handling/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
import io
from contextlib import redirect_stdout
from tarfile import TarError, TarFile, TarInfo
from zipfile import BadZipFile
from typing import Generator
from zipfile import BadZipFile

from conda_package_streaming.extract import exceptions as cps_exceptions
from conda_package_streaming.extract import extract_stream, package_streaming

from . import exceptions


def _stream_components(
filename: str, components: list[str]
) -> Generator[tuple[TarFile, TarInfo], None, None]:
Expand All @@ -30,7 +31,7 @@ def _stream_components(
)
except (OSError, TarError, BadZipFile) as e:
raise exceptions.InvalidArchiveError(filename, f"failed with error: {str(e)}") from e


def _extract(filename: str, dest_dir: str, components: list[str]):
"""
Expand All @@ -48,7 +49,7 @@ def _extract(filename: str, dest_dir: str, components: list[str]):
extract_stream(stream, dest_dir)
except cps_exceptions.CaseInsensitiveFileSystemError as e:
raise exceptions.CaseInsensitiveFileSystemError(filename, dest_dir) from e


def _list(filename: str, components: list[str], verbose=True):
memfile = io.StringIO()
Expand Down
14 changes: 11 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,17 @@ def test_import_main():
@pytest.mark.parametrize(
"url,n_files",
[
("https://conda.anaconda.org/conda-forge/noarch/conda-package-handling-2.2.0-pyh38be061_0.conda", 51),
("https://conda.anaconda.org/conda-forge/linux-64/conda-package-handling-1.9.0-py311hd4cff14_1.tar.bz2", 81),
]
(
"https://conda.anaconda.org/conda-forge/noarch/"
"conda-package-handling-2.2.0-pyh38be061_0.conda",
51,
),
(
"https://conda.anaconda.org/conda-forge/linux-64/"
"conda-package-handling-1.9.0-py311hd4cff14_1.tar.bz2",
81,
),
],
)
def test_list(tmp_path, url, n_files):
"Integration test to ensure `cph list` works correctly."
Expand Down

0 comments on commit bf4c8c0

Please sign in to comment.