Skip to content

Commit 337f002

Browse files
authored
fix(TestExtractFilePkg): avoid downloading pkg file in tests (#1784)
1 parent 25182a2 commit 337f002

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

test/assets/test.pkg

216 Bytes
Binary file not shown.

test/test_extractor.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
from asyncio import coroutine
1212
from io import BytesIO
1313
from pathlib import Path
14-
from test.utils import (
15-
CURL_7_20_0_URL,
16-
GLIB_PKG_URL,
17-
TAR_ZST_URL,
18-
TMUX_DEB,
19-
download_file,
20-
)
14+
from test.utils import CURL_7_20_0_URL, TAR_ZST_URL, TMUX_DEB, download_file
2115
from typing import Dict, List
2216
from zipfile import ZipFile, ZipInfo
2317

@@ -36,6 +30,7 @@
3630
DOVECOT_FILE_PATH = (
3731
TEST_DIR_PATH / "condensed-downloads" / "dovecot-2.3.14-1.fc34.i686.rpm"
3832
)
33+
PKG_FILE_PATH = TEST_DIR_PATH / "assets" / "test.pkg"
3934
CAB_TEST_FILE_PATH = TEST_DIR_PATH / "assets" / "cab-test-python3.8.cab"
4035

4136

@@ -177,7 +172,7 @@ class TestExtractFilePkg(TestExtractorBase):
177172

178173
def setup_method(self):
179174
assert inpath("tar") or inpath("7z"), "Required tools 'tar' or '7z' not found"
180-
download_file(GLIB_PKG_URL, self.tempdir / "test.pkg")
175+
shutil.copyfile(PKG_FILE_PATH, self.tempdir / "test.pkg")
181176

182177
@pytest.fixture
183178
def extension_list(self) -> List[str]:
@@ -211,7 +206,7 @@ async def test_extract_file_pkg(
211206
async for extracted_path in self.extract_files(
212207
[f"test{extension}" for extension in extension_list]
213208
):
214-
assert (Path(extracted_path) / "usr" / "local" / "bin" / "gio").is_file()
209+
assert (Path(extracted_path) / "dir" / "dir2" / "file").is_file()
215210

216211

217212
class TestExtractFileRpmWithZstd(TestExtractorBase):

test/utils.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
TMUX_DEB = "https://mirrors.cat.pdx.edu/ubuntu/pool/main/t/tmux/" + TMUX_DEB_NAME
2323
TAR_ZST_NAME = "tar-1.34-1-x86_64.pkg.tar.zst"
2424
TAR_ZST_URL = "https://ftp5.gwdg.de/pub/linux/archlinux/core/os/x86_64/" + TAR_ZST_NAME
25-
GLIB_PKG_NAME = "glib-2.70.4_3,2.pkg"
26-
GLIB_PKG_URL = (
27-
"https://pkg.freebsd.org/FreeBSD:12:aarch64/quarterly/All/" + GLIB_PKG_NAME
28-
)
2925

3026

3127
class TempDirTest:

0 commit comments

Comments
 (0)