Fix tests for variable change, and change monkeypatches to use the context manager

This commit is contained in:
Veronica K. B. Olsen
2021-02-18 19:21:46 +01:00
parent 8b0ac6e81e
commit e4d03f9581
28 changed files with 274 additions and 296 deletions
+3 -3
View File
@@ -534,9 +534,9 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
# Faulty Keyword Inserts
assert not nwGUI.docEditor.insertKeyWord("blabla")
monkeypatch.setattr(QTextBlock, "isValid", lambda *args, **kwards: False)
assert not nwGUI.docEditor.insertKeyWord(nwKeyWords.TAG_KEY)
monkeypatch.undo()
with monkeypatch.context() as mp:
mp.setattr(QTextBlock, "isValid", lambda *args, **kwards: False)
assert not nwGUI.docEditor.insertKeyWord(nwKeyWords.TAG_KEY)
nwGUI.docEditor.clear()