diff --git a/src/conda_package_handling/streaming.py b/src/conda_package_handling/streaming.py index 6496f4a6..160ccd76 100644 --- a/src/conda_package_handling/streaming.py +++ b/src/conda_package_handling/streaming.py @@ -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]: @@ -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]): """ @@ -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() diff --git a/tests/test_cli.py b/tests/test_cli.py index 1ac3e6fa..63dd196c 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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."