Addon Manager: Modify dialog closing during tests

This commit is contained in:
Chris Hennes
2023-01-02 15:08:52 -06:00
parent 3bae9ab611
commit 7cbecd46c7
3 changed files with 11 additions and 21 deletions

View File

@@ -60,7 +60,6 @@ class TestUninstallerGUI(unittest.TestCase):
translate("AddonsInstaller", "Confirm remove"),
QtWidgets.QDialogButtonBox.Yes,
)
QtCore.QTimer.singleShot(10, dialog_watcher.run)
answer = self.uninstaller_gui._confirm_uninstallation()
self.assertTrue(
dialog_watcher.dialog_found, "Failed to find the expected dialog box"
@@ -75,7 +74,6 @@ class TestUninstallerGUI(unittest.TestCase):
translate("AddonsInstaller", "Confirm remove"),
QtWidgets.QDialogButtonBox.Cancel,
)
QtCore.QTimer.singleShot(10, dialog_watcher.run)
answer = self.uninstaller_gui._confirm_uninstallation()
self.assertTrue(
dialog_watcher.dialog_found, "Failed to find the expected dialog box"
@@ -92,7 +90,6 @@ class TestUninstallerGUI(unittest.TestCase):
translate("AddonsInstaller", "Removing Addon"),
QtWidgets.QDialogButtonBox.Cancel,
)
QtCore.QTimer.singleShot(10, dialog_watcher.run)
self.uninstaller_gui._show_progress_dialog()
# That call isn't modal, so spin our own event loop:
while self.uninstaller_gui.progress_dialog.isVisible():
@@ -110,7 +107,6 @@ class TestUninstallerGUI(unittest.TestCase):
translate("AddonsInstaller", "Removing Addon"),
QtWidgets.QDialogButtonBox.Cancel,
)
QtCore.QTimer.singleShot(10, dialog_watcher.run)
QtCore.QTimer.singleShot(20, worker.stop)
self.uninstaller_gui._confirm_uninstallation = lambda: True
self.uninstaller_gui._run_uninstaller = worker.work
@@ -131,7 +127,6 @@ class TestUninstallerGUI(unittest.TestCase):
translate("AddonsInstaller", "Uninstall complete"),
QtWidgets.QDialogButtonBox.Ok,
)
QtCore.QTimer.singleShot(10, dialog_watcher.run)
self.uninstaller_gui._succeeded(self.addon_to_remove)
self.assertTrue(
dialog_watcher.dialog_found, "Failed to find the expected dialog box"
@@ -145,7 +140,6 @@ class TestUninstallerGUI(unittest.TestCase):
translate("AddonsInstaller", "Uninstall failed"),
QtWidgets.QDialogButtonBox.Ok,
)
QtCore.QTimer.singleShot(10, dialog_watcher.run)
self.uninstaller_gui._failed(
self.addon_to_remove, "Some failure message\nAnother failure message"
)