From be03df1b86b3e8a201360c2ca0cd8be4d45487a9 Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Wed, 19 Feb 2025 17:10:56 -0800 Subject: [PATCH] fix overwrite test --- lib/spack/spack/test/installer.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/spack/spack/test/installer.py b/lib/spack/spack/test/installer.py index 54f1783645f..791070ce5ab 100644 --- a/lib/spack/spack/test/installer.py +++ b/lib/spack/spack/test/installer.py @@ -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():