package_base.py: Fix #34006: test msg needs to be a string (#34007)

This commit is contained in:
Chris Green 2022-11-19 06:02:51 -06:00 committed by GitHub
parent 602984460d
commit 409cf185ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -2447,12 +2447,12 @@ def run_test_callbacks(builder, method_names, callback_type="install"):
try: try:
fn = getattr(builder, name) fn = getattr(builder, name)
msg = ("RUN-TESTS: {0}-time tests [{1}]".format(callback_type, name),) msg = "RUN-TESTS: {0}-time tests [{1}]".format(callback_type, name)
print_test_message(logger, msg, True) print_test_message(logger, msg, True)
fn() fn()
except AttributeError as e: except AttributeError as e:
msg = ("RUN-TESTS: method not implemented [{0}]".format(name),) msg = "RUN-TESTS: method not implemented [{0}]".format(name)
print_test_message(logger, msg, True) print_test_message(logger, msg, True)
builder.pkg.test_failures.append((e, msg)) builder.pkg.test_failures.append((e, msg))

View file

@ -1178,3 +1178,11 @@ def install_use_buildcache(opt):
# Alternative to --cache-only (always) or --no-cache (never) # Alternative to --cache-only (always) or --no-cache (never)
for opt in ["auto", "only", "never"]: for opt in ["auto", "only", "never"]:
install_use_buildcache(opt) install_use_buildcache(opt)
@pytest.mark.regression("34006")
@pytest.mark.disable_clean_stage_check
def test_padded_install_runtests_root(install_mockery_mutable_config, mock_fetch):
spack.config.set("config:install_tree:padded_length", 255)
output = install("--test=root", "--no-cache", "test-build-callbacks", fail_on_error=False)
assert output.count("method not implemented") == 1