Skip to content

Commit

Permalink
tests: mock QMessageBox.information too
Browse files Browse the repository at this point in the history
The clone operation uses QMessageBox.information now to inform about
success. Do not hang waiting for click there.

Fixes: 8500b36 "clone_vm: Don't use warning MessageBox on success"
  • Loading branch information
marmarek committed Aug 21, 2024
1 parent 068e6e7 commit 7af410e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions qubesmanager/tests/test_clone_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ def setUp(self):
self.mock_progress = self.patcher_progress.start()
self.addCleanup(self.patcher_progress.stop)

# mock the progress dialog to speed testing up
# mock the message dialog to not hang on success
self.patcher_warning = unittest.mock.patch(
'PyQt5.QtWidgets.QMessageBox.warning')
self.mock_warning = self.patcher_warning.start()
self.addCleanup(self.patcher_warning.stop)
self.patcher_information = unittest.mock.patch(
'PyQt5.QtWidgets.QMessageBox.information')
self.mock_information = self.patcher_information.start()
self.addCleanup(self.patcher_information.stop)

self.dialog = clone_vm.CloneVMDlg(self.qtapp, self.qapp)

Expand Down Expand Up @@ -229,11 +233,15 @@ def setUp(self):
self.mock_progress = self.patcher_progress.start()
self.addCleanup(self.patcher_progress.stop)

# mock the progress dialog to speed testing up
# mock the message dialog to not hang on success
self.patcher_warning = unittest.mock.patch(
'PyQt5.QtWidgets.QMessageBox.warning')
self.mock_warning = self.patcher_warning.start()
self.addCleanup(self.patcher_warning.stop)
self.patcher_information = unittest.mock.patch(
'PyQt5.QtWidgets.QMessageBox.information')
self.mock_information = self.patcher_information.start()
self.addCleanup(self.patcher_information.stop)

self.src_vm = next(
domain for domain in self.qapp.domains
Expand Down

0 comments on commit 7af410e

Please sign in to comment.