fix overwrite test

This commit is contained in:
Gregory Becker 2025-02-19 17:10:56 -08:00
parent e3d3230c9b
commit be03df1b86
No known key found for this signature in database
GPG Key ID: 2362541F6D14ED84

View File

@ -1296,24 +1296,15 @@ def test_overwrite_install_backup_failure(
fs.touchp(installed_file)
monkeypatch.setattr(inst, "build_process", remove_backup)
called = False
def remove(*args, **kwargs):
called = True
monkeypatch.setattr(spack.store.STORE.db, "remove", remove)
# Make sure that the installer does an overwrite install
monkeypatch.setattr(task, "_install_action", inst.InstallAction.OVERWRITE)
# Installation should throw the installation exception, not the backup
# failure.
installer.start_task(task, install_status, term_status)
with pytest.raises(Exception, match="Some fatal install error"):
installer.complete_task(task, install_status)
# Make sure that `remove` was called on the database after an unsuccessful
# attempt to restore the backup.
assert called
# This error is raised while handling the original install error
installer.start_task(task, install_status, term_status)
with pytest.raises(Exception, match="No such spec in database"):
installer.complete_task(task, install_status)
def test_term_status_line():