bugfix for error message when input spec does not satisfy concretizer output

Signed-off-by: Gregory Becker <becker33@llnl.gov>
This commit is contained in:
Gregory Becker 2025-04-22 17:43:30 -07:00
parent d792121cde
commit 2c43131aca
No known key found for this signature in database
GPG Key ID: 2362541F6D14ED84
2 changed files with 11 additions and 8 deletions

View File

@ -1090,12 +1090,13 @@ def _handle_solver_bug(
stream=out,
)
if wrong_output:
msg = (
"internal solver error: the following specs were concretized, but do not satisfy the "
"input:\n - "
+ "\n - ".join(str(s) for s, _ in wrong_output)
+ "\n Please report a bug at https://github.com/spack/spack/issues"
)
msg = "internal solver error: the following specs were concretized, but do not satisfy "
msg += "the input:\n"
for in_spec, out_spec in wrong_output:
msg += f" - input: {in_spec}\n"
msg += f" output: {out_spec.long_spec}\n"
msg += "\n Please report a bug at https://github.com/spack/spack/issues"
# try to write the input/output specs to a temporary directory for bug reports
try:
tmpdir = tempfile.mkdtemp(prefix="spack-asp-", dir=root)

View File

@ -81,8 +81,10 @@ def test_internal_error_handling_formatting(tmp_path):
assert "the following specs were not solved:\n - baz+z\n" in output
assert (
"the following specs were concretized, but do not satisfy the input:\n"
" - foo+x\n"
" - bar+y\n"
" - input: foo+x\n"
" output: foo@=1.0~x\n"
" - input: bar+y\n"
" output: x@=1.0~y"
) in output
files = {f.name: str(f) for f in tmp_path.glob("spack-asp-*/*.json")}