Skip to content

Commit bfcbeaa

Browse files
committed
Disable exception dialogs to prevent tests from blocking
1 parent b977768 commit bfcbeaa

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

tests/conftest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,18 @@
1111
from activity_browser.layouts import pages
1212

1313

14+
@pytest.fixture
15+
def no_exception_dialogs(monkeypatch):
16+
"""Monkeypatch QMessageBox.critical to do nothing, to avoid blocking tests."""
17+
from qtpy import QtWidgets
18+
19+
monkeypatch.setattr(QtWidgets.QMessageBox, "critical", lambda *args, **kwargs: None)
20+
yield
21+
# No need to undo the monkeypatch, pytest does it automatically
22+
23+
1424
@pytest.fixture()
15-
def main_window(qtbot):
25+
def main_window(qtbot, monkeypatch, no_exception_dialogs):
1626
"""Return the main window of the application instance."""
1727
main_window = MainWindow()
1828
central_widget = CentralTabWidget(main_window)

0 commit comments

Comments
 (0)