aboutsummaryrefslogtreecommitdiff
path: root/tests/test_backend_install.py
diff options
context:
space:
mode:
authorBenjamin Klimczak <benjamin.klimczak@arm.com>2024-03-21 17:33:17 +0000
committerBenjamin Klimczak <benjamin.klimczak@arm.com>2024-03-22 10:06:28 +0000
commitc7ee5b783f044d7ff641773aa385840f5ff944cc (patch)
tree297f308978b00282d8ebd3a1f71e1ae5e678a767 /tests/test_backend_install.py
parent508281df31dc3c18f2e007f4dd505160342a681a (diff)
downloadmlia-c7ee5b783f044d7ff641773aa385840f5ff944cc.tar.gz
refactor: Backend dependencies and more
- Add backend dependencies: One backend can now depend on another backend. - Re-factor 'DownloadArtifact': - Rename 'DownloadArtifact' to 'DownloadConfig' - Remove attributes 'name' and 'version' not relevant for downloads - Add helper properties: - 'filename' parses the URL to extract the file name from the end - 'headers' calls the function to generate a HTML header for the download - Add OutputLogger helper class - Re-factor handling of backend configurations in the target profiles. Change-Id: Ifda6cf12c375d0c1747d7e4130a0370d22c3d33a Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
Diffstat (limited to 'tests/test_backend_install.py')
-rw-r--r--tests/test_backend_install.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/test_backend_install.py b/tests/test_backend_install.py
index 963766e..3636fb4 100644
--- a/tests/test_backend_install.py
+++ b/tests/test_backend_install.py
@@ -20,6 +20,7 @@ from mlia.backend.install import InstallFromPath
from mlia.backend.install import PackagePathChecker
from mlia.backend.install import StaticPathChecker
from mlia.backend.repo import BackendRepository
+from mlia.utils.download import DownloadConfig
@pytest.fixture(name="backend_repo")
@@ -104,11 +105,9 @@ def test_backend_installation_from_path(
def test_backend_installation_download_and_install(
- tmp_path: Path, backend_repo: MagicMock
+ tmp_path: Path, backend_repo: MagicMock, monkeypatch: pytest.MonkeyPatch
) -> None:
"""Test methods of backend installation."""
- download_artifact_mock = MagicMock()
-
tmp_archive = tmp_path.joinpath("sample.tgz")
sample_file = tmp_path.joinpath("sample.txt")
sample_file.touch()
@@ -116,13 +115,17 @@ def test_backend_installation_download_and_install(
with tarfile.open(tmp_archive, "w:gz") as archive:
archive.add(sample_file)
- download_artifact_mock.download_to.return_value = tmp_archive
+ monkeypatch.setattr("mlia.backend.install.download", MagicMock())
+ monkeypatch.setattr(
+ "mlia.utils.download.DownloadConfig.filename",
+ tmp_archive,
+ )
installation = BackendInstallation(
"sample_backend",
"Sample backend",
"sample_backend",
- download_artifact_mock,
+ DownloadConfig(url="NOT_USED", sha256_hash="NOT_USED"),
None,
lambda path: BackendInfo(path, copy_source=False),
lambda eula_agreement, path: path,