Compare commits

...

6 Commits

Author SHA1 Message Date
Harmen Stoppels
f84a500aab builtin.mock -> builtin_mock in test data 2025-05-14 17:06:00 +02:00
Harmen Stoppels
1fcf707096 fix test 2025-05-14 16:46:41 +02:00
Harmen Stoppels
fb690967e1 environment.py: fix env.repo 2025-05-14 16:46:34 +02:00
Harmen Stoppels
1c05b1dd1b fix various tests 2025-05-14 16:34:23 +02:00
Harmen Stoppels
93e0d99553 fix a few imports 2025-05-14 15:27:13 +02:00
Harmen Stoppels
e09325fe9f upgrade mock packages to api v2 2025-05-14 15:24:37 +02:00
545 changed files with 327 additions and 323 deletions

View File

@ -5,6 +5,7 @@
import collections.abc
import contextlib
import errno
import glob
import os
import pathlib
import re
@ -2424,19 +2425,11 @@ def display_specs(specs):
def make_repo_path(root):
"""Make a RepoPath from the repo subdirectories in an environment."""
path = spack.repo.RepoPath(cache=spack.caches.MISC_CACHE)
if os.path.isdir(root):
for repo_root in os.listdir(root):
repo_root = os.path.join(root, repo_root)
if not os.path.isdir(repo_root):
continue
repo = spack.repo.from_path(repo_root)
path.put_last(repo)
return path
repos = [
spack.repo.from_path(os.path.dirname(p))
for p in glob.glob(os.path.join(root, "**", "repo.yaml"), recursive=True)
]
return spack.repo.RepoPath(*repos, cache=spack.caches.MISC_CACHE)
def manifest_file(env_name_or_dir):

View File

@ -58,7 +58,7 @@
repos_path = os.path.join(var_path, "repos")
test_repos_path = os.path.join(var_path, "test_repos")
packages_path = os.path.join(repos_path, "spack_repo", "builtin")
mock_packages_path = os.path.join(test_repos_path, "builtin.mock")
mock_packages_path = os.path.join(test_repos_path, "spack_repo", "builtin_mock")
#
# Writable things in $spack/var/spack

View File

@ -153,7 +153,7 @@ def compute_loader(self, fullname: str):
def builtin_repo() -> "Repo":
"""Get the test repo if it is active, otherwise the builtin repo."""
try:
return PATH.get_repo("builtin.mock")
return PATH.get_repo("builtin_mock")
except UnknownNamespaceError:
return PATH.get_repo("builtin")

View File

@ -15,7 +15,7 @@
@pytest.fixture()
def builder_test_repository(config):
builder_test_path = os.path.join(spack.paths.test_repos_path, "builder.test")
builder_test_path = os.path.join(spack.paths.test_repos_path, "spack_repo", "builder_test")
with spack.repo.use_repositories(builder_test_path) as mock_repo:
yield mock_repo

View File

@ -549,11 +549,10 @@ def test_url_buildcache_entry_v2_exists(
):
"""Test existence check for v2 buildcache entries"""
test_mirror_path = v2_buildcache_layout("unsigned")
mirror_url = f"file://{test_mirror_path}"
mirror_url = pathlib.Path(test_mirror_path).as_uri()
mirror("add", "v2mirror", mirror_url)
with capsys.disabled():
output = buildcache("list", "-a", "-l")
output = buildcache("list", "-a", "-l")
assert "Fetching an index from a v2 binary mirror layout" in output
assert "is deprecated" in output

View File

@ -136,7 +136,7 @@ def test_ci_generate_with_env(ci_generate_test, tmp_path, mock_binary_index):
- old-gcc-pkgs:
- archive-files
- callpath
# specify ^openblas-with-lapack to ensure that builtin.mock repo flake8
# specify ^openblas-with-lapack to ensure that builtin_mock repo flake8
# package (which can also provide lapack) is not chosen, as it violates
# a package-level check which requires exactly one fetch strategy (this
# is apparently not an issue for other tests that use it).

View File

@ -886,12 +886,12 @@ def test_env_activate_broken_view(
with spack.repo.use_repositories(mock_custom_repository):
wrong_repo = env("activate", "--sh", "test")
assert "Warning: could not load runtime environment" in wrong_repo
assert "Unknown namespace: builtin.mock" in wrong_repo
assert "Unknown namespace: builtin_mock" in wrong_repo
# test replacing repo fixes it
normal_repo = env("activate", "--sh", "test")
assert "Warning: could not load runtime environment" not in normal_repo
assert "Unknown namespace: builtin.mock" not in normal_repo
assert "Unknown namespace: builtin_mock" not in normal_repo
def test_to_lockfile_dict():
@ -916,7 +916,7 @@ def test_env_repo():
pkg_cls = e.repo.get_pkg_class("mpileaks")
assert pkg_cls.name == "mpileaks"
assert pkg_cls.namespace == "builtin.mock"
assert pkg_cls.namespace == "builtin_mock"
def test_user_removed_spec(environment_from_manifest):

View File

@ -123,24 +123,24 @@ def test_find_external_cmd_not_buildable(mutable_config, working_env, mock_execu
["detectable"],
[],
[
"builtin.mock.find-externals1",
"builtin.mock.gcc",
"builtin.mock.llvm",
"builtin.mock.intel-oneapi-compilers",
"builtin_mock.find-externals1",
"builtin_mock.gcc",
"builtin_mock.llvm",
"builtin_mock.intel-oneapi-compilers",
],
),
# find --all --exclude find-externals1
(
None,
["detectable"],
["builtin.mock.find-externals1"],
["builtin.mock.gcc", "builtin.mock.llvm", "builtin.mock.intel-oneapi-compilers"],
["builtin_mock.find-externals1"],
["builtin_mock.gcc", "builtin_mock.llvm", "builtin_mock.intel-oneapi-compilers"],
),
(
None,
["detectable"],
["find-externals1"],
["builtin.mock.gcc", "builtin.mock.llvm", "builtin.mock.intel-oneapi-compilers"],
["builtin_mock.gcc", "builtin_mock.llvm", "builtin_mock.intel-oneapi-compilers"],
),
# find cmake (and cmake is not detectable)
(["cmake"], ["detectable"], [], []),

View File

@ -129,7 +129,7 @@ def test_tag2_tag3(parser, specs):
@pytest.mark.db
def test_namespaces_shown_correctly(args, with_namespace, database):
"""Test that --namespace(s) works. Old syntax is --namespace"""
assert ("builtin.mock.zmpi" in find(*args)) == with_namespace
assert ("builtin_mock.zmpi" in find(*args)) == with_namespace
@pytest.mark.db

View File

@ -143,13 +143,13 @@ def test_list_count():
def test_list_repos():
with spack.repo.use_repositories(
os.path.join(spack.paths.test_repos_path, "builtin.mock"),
os.path.join(spack.paths.test_repos_path, "builder.test"),
os.path.join(spack.paths.test_repos_path, "spack_repo", "builtin_mock"),
os.path.join(spack.paths.test_repos_path, "spack_repo", "builder_test"),
):
total_pkgs = len(list().strip().split())
mock_pkgs = len(list("-r", "builtin.mock").strip().split())
builder_pkgs = len(list("-r", "builder.test").strip().split())
both_repos = len(list("-r", "builtin.mock", "-r", "builder.test").strip().split())
mock_pkgs = len(list("-r", "builtin_mock").strip().split())
builder_pkgs = len(list("-r", "builder_test").strip().split())
both_repos = len(list("-r", "builtin_mock", "-r", "builder_test").strip().split())
assert total_pkgs > mock_pkgs > builder_pkgs
assert both_repos == total_pkgs

View File

@ -37,9 +37,11 @@ def install(self, spec, prefix):
# Force all tests to use a git repository *in* the mock packages repo.
@pytest.fixture(scope="module")
def mock_pkg_git_repo(git, tmp_path_factory):
"""Copy the builtin.mock repo and make a mutable git repo inside it."""
"""Copy the builtin_mock repo and make a mutable git repo inside it."""
root_dir = tmp_path_factory.mktemp("mock_pkg_git_repo")
repo_dir = root_dir / "builtin.mock"
# create spack_repo subdir
(root_dir / "spack_repo").mkdir()
repo_dir = root_dir / "spack_repo" / "builtin_mock"
shutil.copytree(spack.paths.mock_packages_path, str(repo_dir))
repo_cache = spack.util.file_cache.FileCache(root_dir / "cache")
@ -57,25 +59,25 @@ def mock_pkg_git_repo(git, tmp_path_factory):
git("-c", "commit.gpgsign=false", "commit", "-m", "initial mock repo commit")
# add commit with mockpkg-a, mockpkg-b, mockpkg-c packages
mkdirp("mockpkg-a", "mockpkg-b", "mockpkg-c")
with open("mockpkg-a/package.py", "w", encoding="utf-8") as f:
mkdirp("mockpkg_a", "mockpkg_b", "mockpkg_c")
with open("mockpkg_a/package.py", "w", encoding="utf-8") as f:
f.write(pkg_template.format(name="PkgA"))
with open("mockpkg-b/package.py", "w", encoding="utf-8") as f:
with open("mockpkg_b/package.py", "w", encoding="utf-8") as f:
f.write(pkg_template.format(name="PkgB"))
with open("mockpkg-c/package.py", "w", encoding="utf-8") as f:
with open("mockpkg_c/package.py", "w", encoding="utf-8") as f:
f.write(pkg_template.format(name="PkgC"))
git("add", "mockpkg-a", "mockpkg-b", "mockpkg-c")
git("add", "mockpkg_a", "mockpkg_b", "mockpkg_c")
git("-c", "commit.gpgsign=false", "commit", "-m", "add mockpkg-a, mockpkg-b, mockpkg-c")
# remove mockpkg-c, add mockpkg-d
with open("mockpkg-b/package.py", "a", encoding="utf-8") as f:
with open("mockpkg_b/package.py", "a", encoding="utf-8") as f:
f.write("\n# change mockpkg-b")
git("add", "mockpkg-b")
mkdirp("mockpkg-d")
with open("mockpkg-d/package.py", "w", encoding="utf-8") as f:
git("add", "mockpkg_b")
mkdirp("mockpkg_d")
with open("mockpkg_d/package.py", "w", encoding="utf-8") as f:
f.write(pkg_template.format(name="PkgD"))
git("add", "mockpkg-d")
git("rm", "-rf", "mockpkg-c")
git("add", "mockpkg_d")
git("rm", "-rf", "mockpkg_c")
git(
"-c",
"commit.gpgsign=false",
@ -90,7 +92,7 @@ def mock_pkg_git_repo(git, tmp_path_factory):
@pytest.fixture(scope="module")
def mock_pkg_names():
repo = spack.repo.PATH.get_repo("builtin.mock")
repo = spack.repo.PATH.get_repo("builtin_mock")
# Be sure to include virtual packages since packages with stand-alone
# tests may inherit additional tests from the virtuals they provide,
@ -116,22 +118,22 @@ def test_builtin_repo():
def test_mock_builtin_repo(mock_packages):
assert spack.repo.builtin_repo() is spack.repo.PATH.get_repo("builtin.mock")
assert spack.repo.builtin_repo() is spack.repo.PATH.get_repo("builtin_mock")
def test_pkg_add(git, mock_pkg_git_repo):
with working_dir(mock_pkg_git_repo):
mkdirp("mockpkg-e")
with open("mockpkg-e/package.py", "w", encoding="utf-8") as f:
mkdirp("mockpkg_e")
with open("mockpkg_e/package.py", "w", encoding="utf-8") as f:
f.write(pkg_template.format(name="PkgE"))
pkg("add", "mockpkg-e")
with working_dir(mock_pkg_git_repo):
try:
assert "A mockpkg-e/package.py" in git("status", "--short", output=str)
assert "A mockpkg_e/package.py" in git("status", "--short", output=str)
finally:
shutil.rmtree("mockpkg-e")
shutil.rmtree("mockpkg_e")
# Removing a package mid-run disrupts Spack's caching
if spack.repo.PATH.repos[0]._fast_package_checker:
spack.repo.PATH.repos[0]._fast_package_checker.invalidate()

View File

@ -48,11 +48,13 @@ def test_resource_list(mock_packages, capfd):
assert "path:" in out
assert (
os.path.join("repos", "builtin.mock", "packages", "patch-a-dependency", "libelf.patch")
os.path.join(
"spack_repo", "builtin_mock", "packages", "patch_a_dependency", "libelf.patch"
)
in out
)
assert "applies to: builtin.mock.libelf" in out
assert "patched by: builtin.mock.patch-a-dependency" in out
assert "applies to: builtin_mock.libelf" in out
assert "patched by: builtin_mock.patch-a-dependency" in out
def test_resource_list_only_hashes(mock_packages, capfd):
@ -74,10 +76,12 @@ def test_resource_show(mock_packages, capfd):
assert out.startswith(test_hash)
assert (
os.path.join("repos", "builtin.mock", "packages", "patch-a-dependency", "libelf.patch")
os.path.join(
"spack_repo", "builtin_mock", "packages", "patch_a_dependency", "libelf.patch"
)
in out
)
assert "applies to: builtin.mock.libelf" in out
assert "patched by: builtin.mock.patch-a-dependency" in out
assert "applies to: builtin_mock.libelf" in out
assert "patched by: builtin_mock.patch-a-dependency" in out
assert len(out.strip().split("\n")) == 4

View File

@ -36,7 +36,7 @@ def test_remote_versions_only():
@pytest.mark.usefixtures("mock_packages")
def test_new_versions_only(monkeypatch):
"""Test a package for which new versions should be available."""
from spack.pkg.builtin.mock.brillig import Brillig # type: ignore[import]
from spack_repo.builtin_mock.packages.brillig.package import Brillig # type: ignore[import]
def mock_fetch_remote_versions(*args, **kwargs):
mock_remote_versions = {

View File

@ -29,7 +29,7 @@ def _concretize_with_reuse(*, root_str, reused_str):
@pytest.fixture
def runtime_repo(mutable_config):
repo = os.path.join(spack.paths.test_repos_path, "compiler_runtime.test")
repo = os.path.join(spack.paths.test_repos_path, "spack_repo", "compiler_runtime_test")
with spack.repo.use_repositories(repo) as mock_repo:
yield mock_repo

View File

@ -78,7 +78,7 @@ def binary_compatibility(monkeypatch, request):
return
if "mock_packages" not in request.fixturenames:
# Only builtin.mock has a mock glibc package
# Only builtin_mock has a mock glibc package
return
if "database" in request.fixturenames or "mutable_database" in request.fixturenames:
@ -373,11 +373,11 @@ def test_provides_handles_multiple_providers_of_same_version(self):
# Note that providers are repo-specific, so we don't misinterpret
# providers, but vdeps are not namespace-specific, so we can
# associate vdeps across repos.
assert Spec("builtin.mock.multi-provider-mpi@1.10.3") in providers
assert Spec("builtin.mock.multi-provider-mpi@1.10.2") in providers
assert Spec("builtin.mock.multi-provider-mpi@1.10.1") in providers
assert Spec("builtin.mock.multi-provider-mpi@1.10.0") in providers
assert Spec("builtin.mock.multi-provider-mpi@1.8.8") in providers
assert Spec("builtin_mock.multi-provider-mpi@1.10.3") in providers
assert Spec("builtin_mock.multi-provider-mpi@1.10.2") in providers
assert Spec("builtin_mock.multi-provider-mpi@1.10.1") in providers
assert Spec("builtin_mock.multi-provider-mpi@1.10.0") in providers
assert Spec("builtin_mock.multi-provider-mpi@1.8.8") in providers
def test_different_compilers_get_different_flags(
self, mutable_config, clang12_with_flags, gcc11_with_flags
@ -1715,12 +1715,12 @@ def test_reuse_with_unknown_namespace_dont_raise(
):
with spack.repo.use_repositories(mock_custom_repository, override=False):
s = spack.concretize.concretize_one("pkg-c")
assert s.namespace != "builtin.mock"
assert s.namespace != "builtin_mock"
PackageInstaller([s.package], fake=True, explicit=True).install()
with spack.config.override("concretizer:reuse", True):
s = spack.concretize.concretize_one("pkg-c")
assert s.namespace == "builtin.mock"
assert s.namespace == "builtin_mock"
@pytest.mark.regression("45538")
def test_reuse_from_other_namespace_no_raise(self, tmpdir, temporary_store, monkeypatch):
@ -1751,7 +1751,7 @@ def test_reuse_with_unknown_package_dont_raise(self, tmpdir, temporary_store, mo
repos.repos[0]._pkg_checker.invalidate()
with spack.config.override("concretizer:reuse", True):
s = spack.concretize.concretize_one("pkg-c")
assert s.namespace == "builtin.mock"
assert s.namespace == "builtin_mock"
@pytest.mark.parametrize(
"specs,checks",
@ -2328,10 +2328,10 @@ def test_reuse_python_from_cli_and_extension_from_db(self, mutable_database):
"spec_str,expected_namespaces",
[
# Single node with fully qualified namespace
("builtin.mock.gmake", {"gmake": "builtin.mock"}),
("builtin_mock.gmake", {"gmake": "builtin_mock"}),
# Dependency with fully qualified namespace
("hdf5 ^builtin.mock.gmake", {"gmake": "builtin.mock", "hdf5": "duplicates.test"}),
("hdf5 ^gmake", {"gmake": "duplicates.test", "hdf5": "duplicates.test"}),
("hdf5 ^builtin_mock.gmake", {"gmake": "builtin_mock", "hdf5": "duplicates_test"}),
("hdf5 ^gmake", {"gmake": "duplicates_test", "hdf5": "duplicates_test"}),
],
)
def test_select_lower_priority_package_from_repository_stack(
@ -2340,8 +2340,10 @@ def test_select_lower_priority_package_from_repository_stack(
"""Tests that a user can explicitly select a lower priority, fully qualified dependency
from cli.
"""
# 'builtin.mock" and "duplicates.test" share a 'gmake' package
additional_repo = os.path.join(spack.paths.test_repos_path, "duplicates.test")
# 'builtin_mock" and "duplicates_test" share a 'gmake' package
additional_repo = os.path.join(
spack.paths.test_repos_path, "spack_repo", "duplicates_test"
)
with spack.repo.use_repositories(additional_repo, override=False):
s = spack.concretize.concretize_one(spec_str)
@ -2585,7 +2587,7 @@ def test_correct_external_is_selected_from_packages_yaml(self, mutable_config):
@pytest.fixture()
def duplicates_test_repository():
repository_path = os.path.join(spack.paths.test_repos_path, "duplicates.test")
repository_path = os.path.join(spack.paths.test_repos_path, "spack_repo", "duplicates_test")
with spack.repo.use_repositories(repository_path) as mock_repo:
yield mock_repo
@ -2820,7 +2822,7 @@ def test_adding_specs(self, input_specs, default_mock_concretization):
@pytest.fixture()
def edges_test_repository():
repository_path = os.path.join(spack.paths.test_repos_path, "edges.test")
repository_path = os.path.join(spack.paths.test_repos_path, "spack_repo", "edges_test")
with spack.repo.use_repositories(repository_path) as mock_repo:
yield mock_repo

View File

@ -46,7 +46,7 @@
@pytest.fixture
def test_repo(mutable_config, monkeypatch, mock_stage):
repo_dir = pathlib.Path(spack.paths.test_repos_path) / "flags.test"
repo_dir = pathlib.Path(spack.paths.test_repos_path) / "spack_repo" / "flags_test"
with spack.repo.use_repositories(str(repo_dir)) as mock_repo_path:
yield mock_repo_path

View File

@ -28,7 +28,7 @@ def update_packages_config(conf_str):
@pytest.fixture
def test_repo(mutable_config, monkeypatch, mock_stage):
repo_dir = pathlib.Path(spack.paths.test_repos_path) / "requirements.test"
repo_dir = pathlib.Path(spack.paths.test_repos_path) / "spack_repo" / "requirements_test"
with spack.repo.use_repositories(str(repo_dir)) as mock_repo_path:
yield mock_repo_path
@ -766,21 +766,21 @@ def test_skip_requirement_when_default_requirement_condition_cannot_be_met(
def test_requires_directive(mock_packages, config):
# This package requires either clang or gcc
s = spack.concretize.concretize_one("requires_clang_or_gcc")
s = spack.concretize.concretize_one("requires-clang-or-gcc")
assert s.satisfies("%gcc")
s = spack.concretize.concretize_one("requires_clang_or_gcc %gcc")
s = spack.concretize.concretize_one("requires-clang-or-gcc %gcc")
assert s.satisfies("%gcc")
s = spack.concretize.concretize_one("requires_clang_or_gcc %clang")
s = spack.concretize.concretize_one("requires-clang-or-gcc %clang")
# Test both the real package (llvm) and its alias (clang)
assert s.satisfies("%llvm") and s.satisfies("%clang")
# This package can only be compiled with clang
s = spack.concretize.concretize_one("requires_clang")
s = spack.concretize.concretize_one("requires-clang")
assert s.satisfies("%llvm")
s = spack.concretize.concretize_one("requires_clang %clang")
s = spack.concretize.concretize_one("requires-clang %clang")
assert s.satisfies("%llvm")
with pytest.raises(spack.error.SpackError, match="can only be compiled with Clang"):
spack.concretize.concretize_one("requires_clang %gcc")
spack.concretize.concretize_one("requires-clang %gcc")
@pytest.mark.parametrize(

View File

@ -654,7 +654,7 @@ def mock_pkg_install(monkeypatch):
@pytest.fixture(scope="function")
def mock_packages(mock_repo_path, mock_pkg_install, request):
"""Use the 'builtin.mock' repository instead of 'builtin'"""
"""Use the 'builtin_mock' repository instead of 'builtin'"""
ensure_configuration_fixture_run_before(request)
with spack.repo.use_repositories(mock_repo_path) as mock_repo:
yield mock_repo
@ -1433,7 +1433,7 @@ def mock_git_repository(git, tmpdir_factory):
of these refers to a repository with a single commit.
c0, c1, and c2 include information to define explicit versions in the
associated builtin.mock package 'git-test'. c3 is a commit in the
associated builtin_mock package 'git-test'. c3 is a commit in the
repository but does not have an associated explicit package version.
"""
suburls = []

View File

@ -26,7 +26,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -70,7 +70,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -114,7 +114,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -137,7 +137,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -160,7 +160,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -183,7 +183,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -215,7 +215,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -253,7 +253,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -276,7 +276,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -314,7 +314,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -337,7 +337,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -368,7 +368,7 @@
"name": "clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],

View File

@ -57,7 +57,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -133,7 +133,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -209,7 +209,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -264,7 +264,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -319,7 +319,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -374,7 +374,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -438,7 +438,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -508,7 +508,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -563,7 +563,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -633,7 +633,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -688,7 +688,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -751,7 +751,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -806,7 +806,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -882,7 +882,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],

View File

@ -58,7 +58,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -136,7 +136,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -214,7 +214,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -268,7 +268,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -322,7 +322,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -376,7 +376,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -440,7 +440,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -511,7 +511,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -565,7 +565,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -636,7 +636,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -690,7 +690,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -753,7 +753,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -807,7 +807,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],
@ -885,7 +885,7 @@
"name": "apple-clang",
"version": "13.0.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],

View File

@ -18,7 +18,7 @@ spec:
compiler:
name: gcc
version: 4.5.0
namespace: builtin.mock
namespace: builtin_mock
parameters:
optimize: true
pic: true

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
7f94d6038bb4e5e7fff817151da5b22d7dd6d1e2d9ad51bd55504676786c17bd
81a5add9d75b27fc4d16a4f72685b54903973366531b98c65e8cf5376758a817

View File

@ -33,7 +33,7 @@ Hash: SHA512
"name":"gcc",
"version":"10.2.1"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -85,7 +85,7 @@ Hash: SHA512
"name":"gcc",
"version":"10.2.1"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],

View File

@ -33,7 +33,7 @@ Hash: SHA512
"name":"gcc",
"version":"10.2.1"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],

View File

@ -57,7 +57,7 @@ Hash: SHA256
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -169,7 +169,7 @@ Hash: SHA256
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -193,7 +193,7 @@ Hash: SHA256
"platform_os":"debian6",
"target":"aarch64"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"languages":[
@ -275,7 +275,7 @@ Hash: SHA256
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -353,7 +353,7 @@ Hash: SHA256
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],

View File

@ -57,7 +57,7 @@ Hash: SHA256
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -157,7 +157,7 @@ Hash: SHA256
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -181,7 +181,7 @@ Hash: SHA256
"platform_os":"debian6",
"target":"aarch64"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"languages":[
@ -263,7 +263,7 @@ Hash: SHA256
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],

View File

@ -57,7 +57,7 @@ Hash: SHA256
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],

View File

@ -57,7 +57,7 @@ Hash: SHA256
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -93,7 +93,7 @@ Hash: SHA256
"platform_os":"debian6",
"target":"aarch64"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"languages":[

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
57cad2589fae55cda3c35cadf4286d2e7702f90a708da80d70a76213fc45a688
fc129b8fab649ab4c5623c874c73bd998a76fd30d2218b9d99340d045c1ec759

View File

@ -30,7 +30,7 @@
"name":"gcc",
"version":"10.2.1"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -82,7 +82,7 @@
"name":"gcc",
"version":"10.2.1"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],

View File

@ -30,7 +30,7 @@
"name":"gcc",
"version":"10.2.1"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],

View File

@ -54,7 +54,7 @@
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -166,7 +166,7 @@
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -190,7 +190,7 @@
"platform_os":"debian6",
"target":"aarch64"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"languages":[
@ -272,7 +272,7 @@
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -350,7 +350,7 @@
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],

View File

@ -54,7 +54,7 @@
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -154,7 +154,7 @@
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -178,7 +178,7 @@
"platform_os":"debian6",
"target":"aarch64"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"languages":[
@ -260,7 +260,7 @@
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],

View File

@ -54,7 +54,7 @@
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],

View File

@ -54,7 +54,7 @@
"cpupart":"0x022"
}
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"cflags":[],
@ -90,7 +90,7 @@
"platform_os":"debian6",
"target":"aarch64"
},
"namespace":"builtin.mock",
"namespace":"builtin_mock",
"parameters":{
"build_system":"generic",
"languages":[

View File

@ -31,7 +31,7 @@
"name": "gcc",
"version": "4.5.0"
},
"namespace": "builtin.mock",
"namespace": "builtin_mock",
"parameters": {
"cflags": [],
"cppflags": [],

View File

@ -2,7 +2,10 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import importlib
import os
import pathlib
import sys
import pytest
@ -43,7 +46,7 @@ def test_nonexisting_package_filename(self):
repo = spack.repo.from_path(mock_packages_path)
filename = repo.filename_for_package_name("some-nonexisting-package")
assert filename == os.path.join(
mock_packages_path, "packages", "some-nonexisting-package", "package.py"
mock_packages_path, "packages", "some_nonexisting_package", "package.py"
)
def test_package_class_names(self):
@ -57,16 +60,19 @@ def test_package_class_names(self):
assert "_None" == pkg_name_to_class_name("none") # reserved keyword
assert "Finally" == pkg_name_to_class_name("finally") # `Finally` is not reserved
# Below tests target direct imports of spack packages from the
# spack.pkg namespace
def test_import_package(self):
import spack.pkg.builtin.mock.mpich # type: ignore[import] # noqa: F401
# Below tests target direct imports of spack packages from the spack.pkg namespace
def test_import_package(self, tmp_path: pathlib.Path):
root, _ = spack.repo.create_repo(str(tmp_path), "testing_repo", package_api=(1, 0))
pkg_path = pathlib.Path(root) / "packages" / "mpich" / "package.py"
pkg_path.parent.mkdir(parents=True)
pkg_path.write_text("foo = 1")
def test_import_package_as(self):
import spack.pkg.builtin.mock # noqa: F401
import spack.pkg.builtin.mock as m # noqa: F401
import spack.pkg.builtin.mock.mpich as mp # noqa: F401
from spack.pkg.builtin import mock # noqa: F401
with spack.repo.use_repositories(root):
importlib.import_module("spack.pkg.testing_repo")
assert importlib.import_module("spack.pkg.testing_repo.mpich").foo == 1
del sys.modules["spack.pkg.testing_repo"]
del sys.modules["spack.pkg.testing_repo.mpich"]
def test_inheritance_of_directives(self):
pkg_cls = spack.repo.PATH.get_pkg_class("simple-inheritance")
@ -97,28 +103,11 @@ def test_inheritance_of_patches(self):
# Will error if inheritor package cannot find inherited patch files
_ = spack.concretize.concretize_one("patch-inheritance")
def test_import_class_from_package(self):
from spack.pkg.builtin.mock.mpich import Mpich # noqa: F401
def test_import_module_from_package(self):
from spack.pkg.builtin.mock import mpich # noqa: F401
def test_import_namespace_container_modules(self):
import spack.pkg # noqa: F401
import spack.pkg as p # noqa: F401
import spack.pkg.builtin # noqa: F401
import spack.pkg.builtin as b # noqa: F401
import spack.pkg.builtin.mock # noqa: F401
import spack.pkg.builtin.mock as m # noqa: F401
from spack import pkg # noqa: F401
from spack.pkg import builtin # noqa: F401
from spack.pkg.builtin import mock # noqa: F401
@pytest.mark.regression("2737")
def test_urls_for_versions(mock_packages, config):
"""Version directive without a 'url' argument should use default url."""
for spec_str in ("url_override@0.9.0", "url_override@1.0.0"):
for spec_str in ("url-override@0.9.0", "url-override@1.0.0"):
s = spack.concretize.concretize_one(spec_str)
url = s.package.url_for_version("0.9.0")
assert url == "http://www.anothersite.org/uo-0.9.0.tgz"

View File

@ -360,11 +360,11 @@ def get_patch(spec, ending):
assert foo_patch.path == os.path.join(package_dir, "foo.patch")
assert foo_patch.sha256 == foo_sha256
assert bar_patch.owner == "builtin.mock.patch-several-dependencies"
assert bar_patch.owner == "builtin_mock.patch-several-dependencies"
assert bar_patch.path == os.path.join(package_dir, "bar.patch")
assert bar_patch.sha256 == bar_sha256
assert baz_patch.owner == "builtin.mock.patch-several-dependencies"
assert baz_patch.owner == "builtin_mock.patch-several-dependencies"
assert baz_patch.path == os.path.join(package_dir, "baz.patch")
assert baz_patch.sha256 == baz_sha256
@ -376,11 +376,11 @@ def get_patch(spec, ending):
url1_patch = get_patch(fake, "urlpatch.patch")
url2_patch = get_patch(fake, "urlpatch2.patch.gz")
assert url1_patch.owner == "builtin.mock.patch-several-dependencies"
assert url1_patch.owner == "builtin_mock.patch-several-dependencies"
assert url1_patch.url == "http://example.com/urlpatch.patch"
assert url1_patch.sha256 == url1_sha256
assert url2_patch.owner == "builtin.mock.patch-several-dependencies"
assert url2_patch.owner == "builtin_mock.patch-several-dependencies"
assert url2_patch.url == "http://example.com/urlpatch2.patch.gz"
assert url2_patch.sha256 == url2_sha256
assert url2_patch.archive_sha256 == url2_archive_sha256
@ -397,7 +397,7 @@ def test_conditional_patched_deps_with_conditions(mock_packages, config):
fake = spec["fake"]
check_multi_dependency_patch_specs(
libelf, libdwarf, fake, "builtin.mock.patch-several-dependencies", spec.package.package_dir
libelf, libdwarf, fake, "builtin_mock.patch-several-dependencies", spec.package.package_dir
)
@ -417,7 +417,7 @@ def test_write_and_read_sub_dags_with_patched_deps(mock_packages, config):
# make sure we can still read patches correctly for these specs
check_multi_dependency_patch_specs(
libelf, libdwarf, fake, "builtin.mock.patch-several-dependencies", spec.package.package_dir
libelf, libdwarf, fake, "builtin_mock.patch-several-dependencies", spec.package.package_dir
)

View File

@ -43,19 +43,19 @@ def extra_repo(tmp_path_factory, request):
def test_repo_getpkg(mutable_mock_repo):
mutable_mock_repo.get_pkg_class("pkg-a")
mutable_mock_repo.get_pkg_class("builtin.mock.pkg-a")
mutable_mock_repo.get_pkg_class("builtin_mock.pkg-a")
def test_repo_multi_getpkg(mutable_mock_repo, extra_repo):
mutable_mock_repo.put_first(extra_repo[0])
mutable_mock_repo.get_pkg_class("pkg-a")
mutable_mock_repo.get_pkg_class("builtin.mock.pkg-a")
mutable_mock_repo.get_pkg_class("builtin_mock.pkg-a")
def test_repo_multi_getpkgclass(mutable_mock_repo, extra_repo):
mutable_mock_repo.put_first(extra_repo[0])
mutable_mock_repo.get_pkg_class("pkg-a")
mutable_mock_repo.get_pkg_class("builtin.mock.pkg-a")
mutable_mock_repo.get_pkg_class("builtin_mock.pkg-a")
def test_repo_pkg_with_unknown_namespace(mutable_mock_repo):
@ -65,7 +65,7 @@ def test_repo_pkg_with_unknown_namespace(mutable_mock_repo):
def test_repo_unknown_pkg(mutable_mock_repo):
with pytest.raises(spack.repo.UnknownPackageError):
mutable_mock_repo.get_pkg_class("builtin.mock.nonexistentpackage")
mutable_mock_repo.get_pkg_class("builtin_mock.nonexistentpackage")
def test_repo_last_mtime(mock_packages):
@ -93,15 +93,6 @@ def test_repo_invisibles(mutable_mock_repo, extra_repo):
extra_repo[0].all_package_names()
@pytest.mark.parametrize("attr_name,exists", [("cmake", True), ("__sphinx_mock__", False)])
@pytest.mark.regression("20661")
def test_namespace_hasattr(attr_name, exists, mutable_mock_repo):
# Check that we don't fail on 'hasattr' checks because
# of a custom __getattr__ implementation
nms = spack.repo.SpackNamespace("spack.pkg.builtin.mock")
assert hasattr(nms, attr_name) == exists
@pytest.mark.regression("24552")
def test_all_package_names_is_cached_correctly(mock_packages):
assert "mpi" in spack.repo.all_package_names(include_virtuals=True)
@ -120,25 +111,20 @@ def test_use_repositories_doesnt_change_class(mock_packages):
assert id(zlib_cls_inner) == id(zlib_cls_outer)
def test_import_repo_prefixes_as_python_modules(mock_packages):
import spack.pkg.builtin.mock
assert isinstance(spack.pkg, spack.repo.SpackNamespace)
assert isinstance(spack.pkg.builtin, spack.repo.SpackNamespace)
assert isinstance(spack.pkg.builtin.mock, spack.repo.SpackNamespace)
def test_absolute_import_spack_packages_as_python_modules(mock_packages):
import spack.pkg.builtin.mock.mpileaks
import spack_repo.builtin_mock.packages.mpileaks.package # type: ignore[import]
assert hasattr(spack.pkg.builtin.mock, "mpileaks")
assert hasattr(spack.pkg.builtin.mock.mpileaks, "Mpileaks")
assert isinstance(spack.pkg.builtin.mock.mpileaks.Mpileaks, spack.package_base.PackageMeta)
assert issubclass(spack.pkg.builtin.mock.mpileaks.Mpileaks, spack.package_base.PackageBase)
assert hasattr(spack_repo.builtin_mock.packages.mpileaks.package, "Mpileaks")
assert isinstance(
spack_repo.builtin_mock.packages.mpileaks.package.Mpileaks, spack.package_base.PackageMeta
)
assert issubclass(
spack_repo.builtin_mock.packages.mpileaks.package.Mpileaks, spack.package_base.PackageBase
)
def test_relative_import_spack_packages_as_python_modules(mock_packages):
from spack.pkg.builtin.mock.mpileaks import Mpileaks
from spack_repo.builtin_mock.packages.mpileaks.package import Mpileaks
assert isinstance(Mpileaks, spack.package_base.PackageMeta)
assert issubclass(Mpileaks, spack.package_base.PackageBase)
@ -160,7 +146,7 @@ def test_repo_path_handles_package_removal(tmpdir, mock_packages):
builder.remove("pkg-c")
with spack.repo.use_repositories(builder.root, override=False) as repos:
r = repos.repo_for_pkg("pkg-c")
assert r.namespace == "builtin.mock"
assert r.namespace == "builtin_mock"
def test_repo_dump_virtuals(tmpdir, mutable_mock_repo, mock_packages, ensure_debug, capsys):
@ -185,7 +171,7 @@ def _repo_paths(repos):
for entry in repos:
if entry == "mock":
repo_paths.append(spack.paths.mock_packages_path)
namespaces.append("builtin.mock")
namespaces.append("builtin_mock")
if entry == "extra":
name = "extra_mock"
repo_dir = tmp_path / name
@ -211,7 +197,7 @@ def test_path_computation_with_names(method_name, mock_repo_path):
repo_path = spack.repo.RepoPath(mock_repo_path, cache=None)
method = getattr(repo_path, method_name)
unqualified = method("mpileaks")
qualified = method("builtin.mock.mpileaks")
qualified = method("builtin_mock.mpileaks")
assert qualified == unqualified
@ -220,11 +206,11 @@ def test_use_repositories_and_import():
import spack.paths
repo_dir = pathlib.Path(spack.paths.test_repos_path)
with spack.repo.use_repositories(str(repo_dir / "compiler_runtime.test")):
import spack.pkg.compiler_runtime.test.gcc_runtime
with spack.repo.use_repositories(str(repo_dir / "spack_repo" / "compiler_runtime_test")):
import spack_repo.compiler_runtime_test.packages.gcc_runtime.package # type: ignore[import] # noqa: E501
with spack.repo.use_repositories(str(repo_dir / "builtin.mock")):
import spack.pkg.builtin.mock.cmake
with spack.repo.use_repositories(str(repo_dir / "spack_repo" / "builtin_mock")):
import spack_repo.builtin_mock.packages.cmake.package # type: ignore[import] # noqa: F401
@pytest.mark.usefixtures("nullify_globals")
@ -236,7 +222,7 @@ class TestRepo:
def test_creation(self, mock_test_cache):
repo = spack.repo.Repo(spack.paths.mock_packages_path, cache=mock_test_cache)
assert repo.config_file.endswith("repo.yaml")
assert repo.namespace == "builtin.mock"
assert repo.namespace == "builtin_mock"
@pytest.mark.parametrize(
"name,expected", [("mpi", True), ("mpich", False), ("mpileaks", False)]
@ -248,7 +234,7 @@ def test_is_virtual(self, repo_cls, name, expected, mock_test_cache):
assert repo.is_virtual_safe(name) is expected
@pytest.mark.parametrize(
"module_name,expected",
"module_name,pkg_name",
[
("dla_future", "dla-future"),
("num7zip", "7zip"),
@ -256,12 +242,19 @@ def test_is_virtual(self, repo_cls, name, expected, mock_test_cache):
("unknown", None),
],
)
def test_real_name(self, module_name, expected, mock_test_cache):
def test_real_name(self, module_name, pkg_name, mock_test_cache, tmp_path):
"""Test that we can correctly compute the 'real' name of a package, from the one
used to import the Python module.
"""
repo = spack.repo.Repo(spack.paths.mock_packages_path, cache=mock_test_cache)
assert repo.real_name(module_name) == expected
path, _ = spack.repo.create_repo(str(tmp_path), package_api=(1, 0))
if pkg_name is not None:
pkg_path = pathlib.Path(path) / "packages" / pkg_name / "package.py"
pkg_path.parent.mkdir(parents=True)
pkg_path.write_text("")
repo = spack.repo.Repo(
path, cache=spack.util.file_cache.FileCache(str(tmp_path / "cache"))
)
assert repo.real_name(module_name) == pkg_name
@pytest.mark.parametrize("name", ["mpileaks", "7zip", "dla-future"])
def test_get(self, name, mock_test_cache):
@ -312,12 +305,12 @@ class TestRepoPath:
def test_creation_from_string(self, mock_test_cache):
repo = spack.repo.RepoPath(spack.paths.mock_packages_path, cache=mock_test_cache)
assert len(repo.repos) == 1
assert repo.by_namespace["builtin.mock"] is repo.repos[0]
assert repo.by_namespace["builtin_mock"] is repo.repos[0]
def test_get_repo(self, mock_test_cache):
repo = spack.repo.RepoPath(spack.paths.mock_packages_path, cache=mock_test_cache)
# builtin.mock is there
assert repo.get_repo("builtin.mock") is repo.repos[0]
# builtin_mock is there
assert repo.get_repo("builtin_mock") is repo.repos[0]
# foo is not there, raise
with pytest.raises(spack.repo.UnknownNamespaceError):
repo.get_repo("foo")

View File

@ -135,16 +135,16 @@ class TestSpecSemantics:
("libelf@0:2.5%gcc@2:4.6", "libelf@2.1:3%gcc@4.5:4.7", "libelf@2.1:2.5%gcc@4.5:4.6"),
# Namespaces
("builtin.mpich", "mpich", "builtin.mpich"),
("builtin.mock.mpich", "mpich", "builtin.mock.mpich"),
("builtin_mock.mpich", "mpich", "builtin_mock.mpich"),
("builtin.mpich", "builtin.mpich", "builtin.mpich"),
("mpileaks ^builtin.mock.mpich", "^mpich", "mpileaks ^builtin.mock.mpich"),
("mpileaks ^builtin_mock.mpich", "^mpich", "mpileaks ^builtin_mock.mpich"),
# Virtual dependencies are fully resolved during concretization, so we can constrain
# abstract specs but that would result in a new node
("mpileaks ^builtin.mock.mpich", "^mpi", "mpileaks ^mpi ^builtin.mock.mpich"),
("mpileaks ^builtin_mock.mpich", "^mpi", "mpileaks ^mpi ^builtin_mock.mpich"),
(
"mpileaks ^builtin.mock.mpich",
"^builtin.mock.mpich",
"mpileaks ^builtin.mock.mpich",
"mpileaks ^builtin_mock.mpich",
"^builtin_mock.mpich",
"mpileaks ^builtin_mock.mpich",
),
# Compilers
("foo%gcc", "%gcc", "foo%gcc"),
@ -455,8 +455,8 @@ def test_concrete_specs_which_satisfies_abstract(self, lhs, rhs, default_mock_co
("foo%gcc@4.3", "%gcc@4.4:4.6"),
("foo@4.0%gcc", "@1:3%gcc"),
("foo@4.0%gcc@4.5", "@1:3%gcc@4.4:4.6"),
("builtin.mock.mpich", "builtin.mpich"),
("mpileaks ^builtin.mock.mpich", "^builtin.mpich"),
("builtin_mock.mpich", "builtin.mpich"),
("mpileaks ^builtin_mock.mpich", "^builtin.mpich"),
("mpileaks^mpich@1.2", "^mpich@2.0"),
("mpileaks^mpich@4.0^callpath@1.5", "^mpich@1:3^callpath@1.4:1.6"),
("mpileaks^mpich@2.0^callpath@1.7", "^mpich@1:3^callpath@1.4:1.6"),
@ -476,7 +476,7 @@ def test_concrete_specs_which_satisfies_abstract(self, lhs, rhs, default_mock_co
("libelf+debug", "libelf~debug"),
("libelf+debug~foo", "libelf+debug+foo"),
("libelf debug=True", "libelf debug=False"),
("namespace=builtin.mock", "namespace=builtin"),
("namespace=builtin_mock", "namespace=builtin"),
],
)
def test_constraining_abstract_specs_with_empty_intersection(self, lhs, rhs):
@ -609,7 +609,7 @@ def test_indirect_unsatisfied_single_valued_variant(self):
def test_satisfied_namespace(self):
spec = spack.concretize.concretize_one("zlib")
assert spec.satisfies("namespace=builtin.mock")
assert spec.satisfies("namespace=builtin_mock")
assert not spec.satisfies("namespace=builtin")
@pytest.mark.parametrize(

View File

@ -1185,7 +1185,7 @@ def test_parse_filename_missing_slash_as_spec(specfile_for, tmpdir, filename):
# make sure that only happens when the spec ends in yaml
with pytest.raises(spack.solver.asp.UnsatisfiableSpecError) as exc_info:
spack.concretize.concretize_one(SpecParser("builtin.mock.doesnotexist").next_spec())
spack.concretize.concretize_one(SpecParser("builtin_mock.doesnotexist").next_spec())
assert not exc_info.value.long_message or (
"Did you mean to specify a filename with" not in exc_info.value.long_message
)

View File

@ -266,7 +266,7 @@ def test_legacy_yaml(tmpdir, install_mockery, mock_packages):
compiler:
name: gcc
version: 8.3.0
namespace: builtin.mock
namespace: builtin_mock
parameters:
bvv: true
foo:
@ -296,7 +296,7 @@ def test_legacy_yaml(tmpdir, install_mockery, mock_packages):
compiler:
name: gcc
version: 8.3.0
namespace: builtin.mock
namespace: builtin_mock
parameters:
cflags: []
cppflags: []

View File

@ -1,2 +0,0 @@
repo:
namespace: builder.test

View File

@ -1 +0,0 @@
../../../repos/spack_repo/builtin/packages/compiler_wrapper

View File

@ -1 +0,0 @@
../../../repos/spack_repo/builtin/packages/gcc_runtime

View File

@ -1,2 +0,0 @@
repo:
namespace: builtin.mock

View File

@ -1 +0,0 @@
../../builtin.mock/packages/compiler-wrapper

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gcc

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gcc-runtime

View File

@ -1 +0,0 @@
../../builtin.mock/packages/glibc

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gmake

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gnuconfig

View File

@ -1,2 +0,0 @@
repo:
namespace: compiler_runtime.test

View File

@ -1 +0,0 @@
../../builtin.mock/packages/compiler-wrapper

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gcc

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gcc-runtime

View File

@ -1 +0,0 @@
../../builtin.mock/packages/glibc

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gnuconfig

View File

@ -1 +0,0 @@
../../builtin.mock/packages/llvm

View File

@ -1 +0,0 @@
../../builtin.mock/packages/python-venv

View File

@ -1,2 +0,0 @@
repo:
namespace: duplicates.test

View File

@ -1 +0,0 @@
../../builtin.mock/packages/compiler-wrapper

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gcc

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gcc-runtime

View File

@ -1 +0,0 @@
../../builtin.mock/packages/glibc

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gmake

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gnuconfig

View File

@ -1 +0,0 @@
../../builtin.mock/packages/llvm

View File

@ -1,2 +0,0 @@
repo:
namespace: edges.test

View File

@ -1 +0,0 @@
../../builtin.mock/packages/compiler-wrapper

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gcc

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gcc-runtime

View File

@ -1 +0,0 @@
../../builtin.mock/packages/glibc

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gmake/

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gnuconfig

View File

@ -1,2 +0,0 @@
repo:
namespace: flags.test

View File

@ -1 +0,0 @@
../../builtin.mock/packages/compiler-wrapper/

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gcc

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gcc-runtime

View File

@ -1 +0,0 @@
../../builtin.mock/packages/glibc

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gmake/

View File

@ -1 +0,0 @@
../../builtin.mock/packages/gnuconfig

View File

@ -1 +0,0 @@
../../builtin.mock/packages/llvm

View File

@ -1,2 +0,0 @@
repo:
namespace: requirements.test

View File

@ -3,17 +3,19 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import spack.pkg.builder.test.callbacks
from spack.package import *
from ..callbacks.package import Callbacks
from ..callbacks.package import GenericBuilder as CallbacksGenericBuilder
class Inheritance(spack.pkg.builder.test.callbacks.Callbacks):
class Inheritance(Callbacks):
"""Package used to verify that inheritance among packages work as expected"""
pass
class GenericBuilder(spack.pkg.builder.test.callbacks.GenericBuilder):
class GenericBuilder(CallbacksGenericBuilder):
def install(self, pkg, spec, prefix):
super().install(pkg, spec, prefix)
os.environ["INHERITANCE_INSTALL_CALLED"] = "1"

View File

@ -1,11 +1,12 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import spack.pkg.builder.test.old_style_autotools
from spack.package import *
from ..old_style_autotools.package import OldStyleAutotools
class OldStyleDerived(spack.pkg.builder.test.old_style_autotools.OldStyleAutotools):
class OldStyleDerived(OldStyleAutotools):
"""Package used to verify that old-style packages work correctly when executing the
installation procedure.
"""

View File

@ -0,0 +1,3 @@
repo:
namespace: builder_test
api: v2.0

Some files were not shown because too many files have changed in this diff Show More