Updated tests for NWSpell* classes

This commit is contained in:
Veronica K. B. Olsen
2020-12-03 18:37:52 +01:00
parent c13bd18271
commit c7c70a35a0
7 changed files with 219 additions and 33 deletions
+3 -4
View File
@@ -6,6 +6,8 @@ import os
import json
import pytest
from dummy import causeOSError
from nw.core import NWProject
from nw.core.options import OptionState
from nw.constants import nwFiles
@@ -44,10 +46,7 @@ def testCoreOptions_LoadSave(monkeypatch, dummyGUI, tmpDir):
assert theProject.projMeta == tmpDir
# Cause open() to fail
def dummyIO(*args, **kwargs):
raise OSError
monkeypatch.setattr("builtins.open", dummyIO)
monkeypatch.setattr("builtins.open", causeOSError)
assert not theOpts.loadSettings()
assert not theOpts.saveSettings()
monkeypatch.undo()