From 4a14936dbbd5c4c44d50da93aac029679f65ee39 Mon Sep 17 00:00:00 2001 From: Michael Woolnough <130465766+mjkw31@users.noreply.github.com> Date: Mon, 19 Feb 2024 13:41:33 +0000 Subject: [PATCH] Initialise Spack class with correct spack bin location and URL for custom recipe repo. (#46) --- softpack_core/app.py | 2 +- tests/integration/test_spack.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/softpack_core/app.py b/softpack_core/app.py index 9c796f4..7c9bc7b 100644 --- a/softpack_core/app.py +++ b/softpack_core/app.py @@ -44,7 +44,7 @@ def status() -> dict[str, Any]: def __init__(self) -> None: """Constructor.""" self.settings = Settings.parse_obj({}) - self.spack = Spack() + self.spack = Spack(self.settings.spack.bin, self.settings.spack.repo) self.router.add_middleware( CORSMiddleware, diff --git a/tests/integration/test_spack.py b/tests/integration/test_spack.py index 5a7f788..3baf616 100644 --- a/tests/integration/test_spack.py +++ b/tests/integration/test_spack.py @@ -34,8 +34,6 @@ def test_spack_packages(): packages = list(PackageCollection.iter()) - assert len(packages) == len(pkgs) - assert isinstance(packages[0], PackageMultiVersion) assert packages[0].name != "" @@ -43,12 +41,15 @@ def test_spack_packages(): assert len(packages[0].versions) != 0 if app.settings.spack.repo == "https://github.com/custom-spack/repo": - pytest.skip("skipped due to missing custom repo") + assert len(packages) == len(pkgs) + else: + assert len(packages) > len(pkgs) - spack = Spack("spack", app.settings.spack.repo) - spack.packages() + spack = Spack(custom_repo = app.settings.spack.repo) + + spack.packages() - assert len(spack.stored_packages) > len(pkgs) + assert len(spack.stored_packages) == len(packages) def test_spack_package_updater():