unit tests: switch test/cmd/versions to mock packages (#50315)

This commit is contained in:
Tamara Dahlgren 2025-05-05 23:08:38 -07:00 committed by GitHub
parent 6219780691
commit ecb122f4c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View File

@ -10,6 +10,9 @@
versions = SpackCommand("versions")
pytestmark = [pytest.mark.usefixtures("mock_packages")]
def test_safe_versions():
"""Only test the safe versions of a package."""
@ -70,11 +73,11 @@ def test_no_unchecksummed_versions():
def test_versions_no_url():
"""Test a package with versions but without a ``url`` attribute."""
versions("graphviz")
versions("attributes-foo-app")
@pytest.mark.maybeslow
def test_no_versions_no_url():
"""Test a package without versions or a ``url`` attribute."""
versions("opengl")
versions("no-url-or-version")

View File

@ -0,0 +1,11 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class NoUrlOrVersion(Package):
"""Mock package that has no url and no version."""
homepage = "https://example.com/"