upgrade mock packages to api v2

This commit is contained in:
Harmen Stoppels 2025-05-14 15:02:56 +02:00
parent 56f40cc1c8
commit e09325fe9f
522 changed files with 179 additions and 171 deletions

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, "builder_test")
with spack.repo.use_repositories(builder_test_path) as mock_repo:
yield mock_repo

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, "builtin_mock"),
os.path.join(spack.paths.test_repos_path, "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,9 @@ 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"
repo_dir = root_dir / "builtin_mock"
shutil.copytree(spack.paths.mock_packages_path, str(repo_dir))
repo_cache = spack.util.file_cache.FileCache(root_dir / "cache")
@ -90,7 +90,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,7 +116,7 @@ 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):

View File

@ -48,11 +48,11 @@ 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("repos", "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 +74,10 @@ 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("repos", "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.pkg.builtin_mock.brillig 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, "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,8 @@ 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, "duplicates_test")
with spack.repo.use_repositories(additional_repo, override=False):
s = spack.concretize.concretize_one(spec_str)
@ -2585,7 +2585,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, "duplicates_test")
with spack.repo.use_repositories(repository_path) as mock_repo:
yield mock_repo
@ -2820,7 +2820,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, "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) / "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) / "requirements_test"
with spack.repo.use_repositories(str(repo_dir)) as mock_repo_path:
yield mock_repo_path

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

@ -60,12 +60,12 @@ def test_package_class_names(self):
# 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
import spack.pkg.builtin_mock.mpich # type: ignore[import] # noqa: F401
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
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
def test_inheritance_of_directives(self):
@ -98,18 +98,18 @@ def test_inheritance_of_patches(self):
_ = spack.concretize.concretize_one("patch-inheritance")
def test_import_class_from_package(self):
from spack.pkg.builtin.mock.mpich import Mpich # noqa: F401
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
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
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

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):
@ -98,7 +98,7 @@ def test_repo_invisibles(mutable_mock_repo, extra_repo):
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")
nms = spack.repo.SpackNamespace("spack.pkg.builtin_mock")
assert hasattr(nms, attr_name) == exists
@ -121,24 +121,24 @@ def test_use_repositories_doesnt_change_class(mock_packages):
def test_import_repo_prefixes_as_python_modules(mock_packages):
import spack.pkg.builtin.mock
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)
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.pkg.builtin_mock.mpileaks
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.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)
def test_relative_import_spack_packages_as_python_modules(mock_packages):
from spack.pkg.builtin.mock.mpileaks import Mpileaks
from spack.pkg.builtin_mock.mpileaks import Mpileaks
assert isinstance(Mpileaks, spack.package_base.PackageMeta)
assert issubclass(Mpileaks, spack.package_base.PackageBase)
@ -160,7 +160,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 +185,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 +211,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 +220,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 / "compiler_runtime_test")):
import spack.pkg.compiler_runtime_test.gcc_runtime
with spack.repo.use_repositories(str(repo_dir / "builtin.mock")):
import spack.pkg.builtin.mock.cmake
with spack.repo.use_repositories(str(repo_dir / "builtin_mock")):
import spack.pkg.builtin_mock.cmake
@pytest.mark.usefixtures("nullify_globals")
@ -236,7 +236,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)]
@ -312,12 +312,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,17 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import spack.pkg.builder.test.callbacks
import spack.pkg.builder_test.callbacks
from spack.package import *
class Inheritance(spack.pkg.builder.test.callbacks.Callbacks):
class Inheritance(spack.pkg.builder_test.callbacks.Callbacks):
"""Package used to verify that inheritance among packages work as expected"""
pass
class GenericBuilder(spack.pkg.builder.test.callbacks.GenericBuilder):
class GenericBuilder(spack.pkg.builder_test.callbacks.GenericBuilder):
def install(self, pkg, spec, prefix):
super().install(pkg, spec, prefix)
os.environ["INHERITANCE_INSTALL_CALLED"] = "1"

View File

@ -1,11 +1,11 @@
# 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
import spack.pkg.builder_test.old_style_autotools
from spack.package import *
class OldStyleDerived(spack.pkg.builder.test.old_style_autotools.OldStyleAutotools):
class OldStyleDerived(spack.pkg.builder_test.old_style_autotools.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

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import * # noqa: F401
from spack.pkg.builtin.mock.cmake_client import CmakeClient
from ..cmake_client.package import CmakeClient
class CmakeClientInheritor(CmakeClient):

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