mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-17 04:34:37 +03:00
Refactor: Allow modifiable download dest path
This adds the parameter `archive_dest` to `run_installer`, which will control where `helper.downloadBinaryFile` will download files, and sets it to "." by default. For convenience/readability, this will also turn any reference to the downloaded file into a `pathlib.Path` object. This makes it easier to ensure that the file ends up in the right location.
This commit is contained in:
@@ -146,11 +146,11 @@ def make_mock_geturl_download_archive(
|
||||
|
||||
def locate_archive() -> MockArchive:
|
||||
for arc in archives:
|
||||
if out == arc.filename_7z:
|
||||
if Path(out).name == arc.filename_7z:
|
||||
return arc
|
||||
assert False, "Requested an archive that was not mocked"
|
||||
|
||||
locate_archive().write_compressed_archive(Path("./"))
|
||||
locate_archive().write_compressed_archive(Path(out).parent)
|
||||
|
||||
return mock_getUrl, mock_download_archive
|
||||
|
||||
@@ -731,6 +731,7 @@ def test_install_installer_archive_extraction_err(monkeypatch):
|
||||
base_dir=temp_dir,
|
||||
command="some_nonexistent_7z_extractor",
|
||||
queue=MockMultiprocessingManager.Queue(),
|
||||
archive_dest=Path(temp_dir),
|
||||
)
|
||||
assert err.type == ArchiveExtractionError
|
||||
err_msg = format(err.value).rstrip()
|
||||
|
||||
Reference in New Issue
Block a user