All message box questions are now handled in test suite, so no need to check for showGUI

This commit is contained in:
Veronica K. B. Olsen
2020-09-28 22:22:29 +02:00
parent 678a31855f
commit 28ef1d12b0
8 changed files with 207 additions and 113 deletions
+23 -1
View File
@@ -9,7 +9,7 @@ import shutil
from os import path, mkdir
from nwdummy import DummyMain
from PyQt5.QtWidgets import QFileDialog, QMessageBox
from PyQt5.QtWidgets import QMessageBox
sys.path.insert(1, path.abspath(path.join(path.dirname(__file__), path.pardir)))
@@ -178,3 +178,25 @@ def nwOldProj(nwTemp):
if path.isdir(oldProjDir):
shutil.rmtree(oldProjDir)
return
##
# Monkey Patch Dialogs
##
@pytest.fixture(scope="function")
def yesToAll(monkeypatch):
"""Make the message boxes/questions always say yes to the dress!
"""
monkeypatch.setattr(
QMessageBox, "question", lambda *args, **kwargs: QMessageBox.Yes
)
monkeypatch.setattr(
QMessageBox, "information", lambda *args, **kwargs: QMessageBox.Yes
)
monkeypatch.setattr(
QMessageBox, "warning", lambda *args, **kwargs: QMessageBox.Yes
)
monkeypatch.setattr(
QMessageBox, "critical", lambda *args, **kwargs: QMessageBox.Yes
)
return