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:
David Dalcino
2021-11-24 13:29:20 -08:00
parent 60018b3bf6
commit 3af9c97ba0
4 changed files with 18 additions and 12 deletions

View File

@@ -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()