inline packages definitions dont have a name
This commit is contained in:
parent
868d538958
commit
6822db0fe7
@ -9,6 +9,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import pathlib
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -22,6 +23,7 @@
|
|||||||
import spack.install_test
|
import spack.install_test
|
||||||
import spack.package
|
import spack.package
|
||||||
import spack.package_base
|
import spack.package_base
|
||||||
|
import spack.repo
|
||||||
import spack.spec
|
import spack.spec
|
||||||
import spack.store
|
import spack.store
|
||||||
from spack.build_systems.generic import Package
|
from spack.build_systems.generic import Package
|
||||||
@ -245,23 +247,31 @@ class BadDetectablePackage(spack.package.Package):
|
|||||||
libraries = ["libFindMe.a"]
|
libraries = ["libFindMe.a"]
|
||||||
|
|
||||||
|
|
||||||
def test_package_url_and_urls():
|
def test_package_url_and_urls(tmp_path: pathlib.Path):
|
||||||
class URLsPackage(spack.package.Package):
|
repo_path = tmp_path / "test-repo"
|
||||||
|
spack.repo.create_repo(str(repo_path))
|
||||||
|
package_py = repo_path / "packages" / "urls-package" / "package.py"
|
||||||
|
package_py.parent.mkdir(parents=True)
|
||||||
|
package_py.write_text(
|
||||||
|
"""\
|
||||||
|
from spack.package import *
|
||||||
|
|
||||||
|
class UrlsPackage(Package):
|
||||||
url = "https://www.example.com/url-package-1.0.tgz"
|
url = "https://www.example.com/url-package-1.0.tgz"
|
||||||
urls = ["https://www.example.com/archive"]
|
urls = ["https://www.example.com/archive"]
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
s = spack.spec.Spec("pkg-a")
|
with spack.repo.use_repositories(str(repo_path)) as repo:
|
||||||
|
pkg_cls = repo.get_pkg_class("urls-package")
|
||||||
|
s = spack.spec.Spec("urls-package")
|
||||||
with pytest.raises(ValueError, match="defines both"):
|
with pytest.raises(ValueError, match="defines both"):
|
||||||
URLsPackage(s)
|
pkg_cls(s)
|
||||||
|
|
||||||
|
|
||||||
def test_package_license():
|
def test_package_license(mock_packages):
|
||||||
class LicensedPackage(spack.package.Package):
|
|
||||||
extendees = None # currently a required attribute for is_extension()
|
|
||||||
license_files = None
|
|
||||||
|
|
||||||
s = spack.spec.Spec("pkg-a")
|
s = spack.spec.Spec("pkg-a")
|
||||||
pkg = LicensedPackage(s)
|
pkg = spack.repo.PATH.get_pkg_class("pkg-a")(s)
|
||||||
assert pkg.global_license_file is None
|
assert pkg.global_license_file is None
|
||||||
|
|
||||||
pkg.license_files = ["license.txt"]
|
pkg.license_files = ["license.txt"]
|
||||||
|
Loading…
Reference in New Issue
Block a user