test for transactional concretization
This commit is contained in:
parent
0f1d36585e
commit
265d80cee3
@ -17,6 +17,7 @@
|
||||
import llnl.util.link_tree
|
||||
|
||||
import spack.cmd.env
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.environment as ev
|
||||
import spack.environment.environment
|
||||
@ -25,6 +26,7 @@
|
||||
import spack.modules
|
||||
import spack.paths
|
||||
import spack.repo
|
||||
import spack.solver.asp
|
||||
import spack.util.spack_json as sjson
|
||||
from spack.cmd.env import _env_create
|
||||
from spack.main import SpackCommand, SpackCommandError
|
||||
@ -2746,6 +2748,40 @@ def test_virtual_spec_concretize_together(tmpdir):
|
||||
assert any(s.package.provides("mpi") for _, s in e.concretized_specs())
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"unify,method_to_fail",
|
||||
[
|
||||
(True, (spack.concretize, "concretize_specs_together")),
|
||||
("when_possible", (spack.solver.asp.Solver, "solve_in_rounds")),
|
||||
],
|
||||
)
|
||||
def test_concretize_transactional(unify, method_to_fail, monkeypatch):
|
||||
e = ev.create("test")
|
||||
e.unify = unify
|
||||
|
||||
e.add("mpi")
|
||||
e.concretize()
|
||||
|
||||
def fail(*args, **kwargs):
|
||||
raise Exception("Test failures")
|
||||
|
||||
location, method = method_to_fail
|
||||
monkeypatch.setattr(location, method, fail)
|
||||
|
||||
first_user_specs = e.concretized_user_specs
|
||||
first_order = e.concretized_order
|
||||
first_hash_dict = e.specs_by_hash
|
||||
|
||||
try:
|
||||
e.concretize(force=True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
assert e.concretized_user_specs == first_user_specs
|
||||
assert e.concretized_order == first_order
|
||||
assert e.specs_by_hash == first_hash_dict
|
||||
|
||||
|
||||
def test_query_develop_specs():
|
||||
"""Test whether a spec is develop'ed or not"""
|
||||
env("create", "test")
|
||||
|
Loading…
Reference in New Issue
Block a user