|
9 | 9 | import unittest.mock
|
10 | 10 | from io import BytesIO
|
11 | 11 | from os import path
|
12 |
| -from test.utils import CURL_7_20_0_URL, TMUX_DEB, download_file |
| 12 | +from test.utils import ( |
| 13 | + CURL_7_20_0_URL, |
| 14 | + GLIB_PKG_URL, |
| 15 | + TAR_ZST_URL, |
| 16 | + TMUX_DEB, |
| 17 | + download_file, |
| 18 | +) |
13 | 19 | from typing import List
|
14 | 20 | from zipfile import ZipFile, ZipInfo
|
15 | 21 |
|
@@ -145,6 +151,45 @@ async def test_extract_file_rpm_no_rpm2cipo(self, extension_list: List[str]):
|
145 | 151 | mock_aio_run_command.assert_not_called()
|
146 | 152 |
|
147 | 153 |
|
| 154 | +class TestExtractFileZst(TestExtractorBase): |
| 155 | + """Tests for the zst file extractor""" |
| 156 | + |
| 157 | + def setup_method(self): |
| 158 | + download_file(TAR_ZST_URL, path.join(self.tempdir, "test.zst")) |
| 159 | + |
| 160 | + @pytest.fixture |
| 161 | + def extension_list(self) -> List[str]: |
| 162 | + return self.extractor.file_extractors[self.extractor.extract_file_zst] |
| 163 | + |
| 164 | + @pytest.mark.asyncio |
| 165 | + async def test_extract_file_zst(self, extension_list: List[str]): |
| 166 | + """Test the zst file extraction""" |
| 167 | + async for extracted_path in self.extract_files( |
| 168 | + [f"test{extension}" for extension in extension_list] |
| 169 | + ): |
| 170 | + assert path.isfile(path.join(extracted_path, "usr", "bin", "tar")) |
| 171 | + |
| 172 | + |
| 173 | +class TestExtractFilePkg(TestExtractorBase): |
| 174 | + """Tests for pkg file extractor""" |
| 175 | + |
| 176 | + def setup_method(self): |
| 177 | + assert inpath("tar") or inpath("7z"), "Required tools 'tar' or '7z' not found" |
| 178 | + download_file(GLIB_PKG_URL, path.join(self.tempdir, "test.pkg")) |
| 179 | + |
| 180 | + @pytest.fixture |
| 181 | + def extension_list(self) -> List[str]: |
| 182 | + return self.extractor.file_extractors[self.extractor.extract_file_pkg] |
| 183 | + |
| 184 | + @pytest.mark.asyncio |
| 185 | + async def test_extract_file_pkg(self, extension_list: List[str]): |
| 186 | + """Test the pkg file extraction""" |
| 187 | + async for extracted_path in self.extract_files( |
| 188 | + [f"test{extension}" for extension in extension_list] |
| 189 | + ): |
| 190 | + assert path.isfile(path.join(extracted_path, "usr", "local", "bin", "gio")) |
| 191 | + |
| 192 | + |
148 | 193 | class TestExtractFileRpmWithZstd(TestExtractorBase):
|
149 | 194 | """Tests for the rpm file extractor (zstd/windows)"""
|
150 | 195 |
|
|
0 commit comments