Skip to content

Commit

Permalink
Initialise Spack class with correct spack bin location and URL for cu…
Browse files Browse the repository at this point in the history
…stom recipe repo.
  • Loading branch information
mjkw31 committed Feb 19, 2024
1 parent 2c63b62 commit 721e2f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion softpack_core/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 7 additions & 6 deletions tests/integration/test_spack.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,22 @@ def test_spack_packages():

packages = list(PackageCollection.iter())

assert len(packages) == len(pkgs)

assert isinstance(packages[0], PackageMultiVersion)

assert packages[0].name != ""

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():
Expand Down

0 comments on commit 721e2f1

Please sign in to comment.