From b02c4904a96c0d6530e18f3806d480adc07e6858 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 31 Jan 2021 11:58:56 +0100 Subject: [PATCH] Fix tests --- tests/test_gui_doceditor.py | 2 ++ tests/test_gui_projtree.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_gui_doceditor.py b/tests/test_gui_doceditor.py index 9ef62951..de19fe9d 100644 --- a/tests/test_gui_doceditor.py +++ b/tests/test_gui_doceditor.py @@ -12,6 +12,7 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import QTextCursor from PyQt5.QtWidgets import QAction, QMessageBox +from nw.gui.projtree import GuiProjectTree from nw.constants import nwItemType, nwDocAction keyDelay = 2 @@ -24,6 +25,7 @@ def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDi """ # Block message box monkeypatch.setattr(QMessageBox, "question", lambda *args: QMessageBox.Yes) + monkeypatch.setattr(GuiProjectTree, "hasFocus", lambda *args: True) # Create new, save, close project nwGUI.theProject.projTree.setSeed(42) diff --git a/tests/test_gui_projtree.py b/tests/test_gui_projtree.py index d49fa7a6..7d895deb 100644 --- a/tests/test_gui_projtree.py +++ b/tests/test_gui_projtree.py @@ -10,6 +10,8 @@ from tools import writeFile from PyQt5.QtCore import QItemSelectionModel from PyQt5.QtWidgets import QAction, QMessageBox +from nw.guimain import GuiMain +from nw.gui.projtree import GuiProjectTree from nw.constants import nwItemType, nwItemClass @pytest.mark.gui @@ -18,7 +20,8 @@ def testGuiProjTree_TreeItems(qtbot, caplog, monkeypatch, nwGUI, nwMinimal): """ # Block message box monkeypatch.setattr(QMessageBox, "question", lambda *args: QMessageBox.Yes) - monkeypatch.setattr("nw.guimain.GuiMain.editItem", lambda *args: None) + monkeypatch.setattr(GuiMain, "editItem", lambda *args: None) + monkeypatch.setattr(GuiProjectTree, "hasFocus", lambda *args: True) nwGUI.theProject.projTree.setSeed(42) nwTree = nwGUI.treeView