Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QApplication is stale in functional tests #2273

Open
cfm opened this issue Oct 29, 2024 · 0 comments
Open

QApplication is stale in functional tests #2273

cfm opened this issue Oct 29, 2024 · 0 comments
Labels
bug Something isn't working tests

Comments

@cfm
Copy link
Member

cfm commented Oct 29, 2024

Given—

—after calling open() on some subclass of ModalDialog, it should be possible to retrieve it in a test with QApplication.instance().activeModalWidget(), but this method always returns None.

Even iterating through QApplication.topLevelWidgets() or QApplication.allWidgets() returns can return a stale instance of the modal dialog.

@cfm cfm added bug Something isn't working tests labels Oct 29, 2024
cfm added a commit that referenced this issue Oct 29, 2024
… of one or more sources

This is a complete rewrite of this test, which now (a) distinguishes
between single- and multi-select behavior and (b) checks that the
individual sources selected for deletion are confirmed and deleted, not
only the *number* of sources selected.

This includes a workaround for #2273.  Here we also change
securedrop_client.gui.widgets.BatchActionToolbar.on_action_triggered()
to call QDialog.open(), which is modal with QDialog.setModal(), rather
than QDialog.exec(), which is modal *and* blocking, which blocks pytest
timers as well as the main event loop.
cfm added a commit that referenced this issue Oct 29, 2024
… of one or more sources

This is a complete rewrite of this test, which now (a) distinguishes
between single- and multi-select behavior and (b) checks that the
individual sources selected for deletion are confirmed and deleted, not
only the *number* of sources selected.

This includes a workaround for #2273.  Here we also change
securedrop_client.gui.widgets.BatchActionToolbar.on_action_triggered()
to call QDialog.open(), which is modal with QDialog.setModal(), rather
than QDialog.exec(), which is modal *and* blocking, which blocks pytest
timers as well as the main event loop.
cfm added a commit that referenced this issue Oct 29, 2024
… of one or more sources

This is a complete rewrite of this test, which now (a) distinguishes
between single- and multi-select behavior and (b) checks that the
individual sources selected for deletion are confirmed and deleted, not
only the *number* of sources selected.

This includes a workaround for #2273.  Here we also change
securedrop_client.gui.widgets.BatchActionToolbar.on_action_triggered()
to call QDialog.open(), which is modal with QDialog.setModal(), rather
than QDialog.exec(), which is modal *and* blocking, which blocks pytest
timers as well as the main event loop.
cfm added a commit that referenced this issue Oct 29, 2024
… of one or more sources

This is a complete rewrite of this test, which now (a) distinguishes
between single- and multi-select behavior and (b) checks that the
individual sources selected for deletion are confirmed and deleted, not
only the *number* of sources selected.

This includes a workaround for #2273.  Here we also change
securedrop_client.gui.widgets.BatchActionToolbar.on_action_triggered()
to call QDialog.open(), which is modal with QDialog.setModal(), rather
than QDialog.exec(), which is modal *and* blocking, which blocks pytest
timers as well as the main event loop.
cfm added a commit that referenced this issue Oct 29, 2024
… of one or more sources

This is a complete rewrite of this test, which now (a) distinguishes
between single- and multi-select behavior and (b) checks that the
individual sources selected for deletion are confirmed and deleted, not
only the *number* of sources selected.

This includes a workaround for #2273.  Here we also change
securedrop_client.gui.widgets.BatchActionToolbar.on_action_triggered()
to call QDialog.open(), which is modal with QDialog.setModal(), rather
than QDialog.exec(), which is modal *and* blocking, which blocks pytest
timers as well as the main event loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tests
Projects
None yet
Development

No branches or pull requests

1 participant