From 179d4be3bee1bf8b93a2e28b4a795215cbf93736 Mon Sep 17 00:00:00 2001 From: catborise Date: Sun, 1 Nov 2026 20:45:41 +0300 Subject: [PATCH] test(vrtManager): the NVRAM copy test checks the error it raised, not its message A libvirtError made in a test takes the message of the thread's last real libvirt error: in a live run, after another test's closed connection, "no marker" read "client socket is closed" and the test failed. It now checks that the move raised that very error, as the test after it does. --- vrtManager/tests/test_migration.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vrtManager/tests/test_migration.py b/vrtManager/tests/test_migration.py index e6d22b80..78cbbd7c 100644 --- a/vrtManager/tests/test_migration.py +++ b/vrtManager/tests/test_migration.py @@ -474,9 +474,13 @@ class NvramCopyTestCase(unittest.TestCase): def test_a_directory_whose_sharing_cannot_be_told_stops_the_move(self): self.shared.stop() - with mock.patch.object(wvmInstances, "same_directory", side_effect=libvirt.libvirtError("no marker")): - with self.assertRaisesRegex(libvirt.libvirtError, "no marker"): + # the raised error is this one: its message can be another libvirt + # error the thread recorded (a closed connection of an earlier live test) + error = libvirt.libvirtError("no marker") + with mock.patch.object(wvmInstances, "same_directory", side_effect=error): + with self.assertRaises(libvirt.libvirtError) as raised: self.move() + self.assertIs(raised.exception, error) self.shared.start() self.assertEqual(self.host.defined, [])