enthought/pyface

Some ModalDialogTester-using tests timing out on macOS

mdickinson opened this issue · 4 comments

Some of the newer tests that use the ModalDialogTester are timing out on macOS. However, because of the way that the GuiTestAssistant works, they end up passing anyway. (We noticed this as a result of proposed changes to the GuiTestAssistant in #1168.)

This is visible in recent test runs - for example, the following snippet from this run with EDM packages, PySide2, macos-latest, shows test_close and test_close_show_alpha taking approximately 15 seconds each.

Tue, 11 Oct 2022 16:02:38 GMT
test_destroy (pyface.tests.test_color_dialog.TestColorDialog) ... ok
Tue, 11 Oct 2022 16:02:38 GMT
test_show_alpha (pyface.tests.test_color_dialog.TestColorDialog) ... ok
Tue, 11 Oct 2022 16:02:53 GMT
test_close (pyface.tests.test_color_dialog.TestGetColor) ... ok
Tue, 11 Oct 2022 16:03:08 GMT
test_close_show_alpha (pyface.tests.test_color_dialog.TestGetColor) ... ok
Tue, 11 Oct 2022 16:03:09 GMT
test_cancel (pyface.tests.test_confirmation_dialog.TestConfirm) ... ok
Tue, 11 Oct 2022 16:03:10 GMT
test_default_cancel (pyface.tests.test_confirmation_dialog.TestConfirm) ... ok
Tue, 11 Oct 2022 16:03:10 GMT
test_default_yes (pyface.tests.test_confirmation_dialog.TestConfirm) ... ok
Tue, 11 Oct 2022 16:03:10 GMT
test_no (pyface.tests.test_confirmation_dialog.TestConfirm) ... ok

This appears to have to do with the dont_quit_when_last_window_closed context manager: that's preventing control from returning to the main thread when the dialog is closed (via reject).

As in #1168, the tests which seem to cause the problems are the tests for the utility functions get_color and get_font which wrap the dialogs, rather than the main tests for the dialogs themselves.

The cause seems to be that the tests in question are using open_and_run; using open_and_wait instead resolves the problem.

Fixed by #1168