fix overwrite test
This commit is contained in:
parent
e3d3230c9b
commit
be03df1b86
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user