Test terminology update
This commit is contained in:
@@ -27,7 +27,7 @@ import configparser
|
||||
|
||||
from shutil import copyfile
|
||||
|
||||
from dummy import causeOSError, DummyApp
|
||||
from mock import causeOSError, MockApp
|
||||
from tools import cmpFiles, writeFile
|
||||
|
||||
from nw.config import Config
|
||||
@@ -195,7 +195,7 @@ def testBaseConfig_Init(monkeypatch, tmpDir, fncDir, outDir, refDir, filesDir):
|
||||
writeFile(os.path.join(i18nDir, "nw_en_GB.ts"), "")
|
||||
writeFile(os.path.join(i18nDir, "nw_abcd.qm"), "")
|
||||
|
||||
tstApp = DummyApp()
|
||||
tstApp = MockApp()
|
||||
tstConf.initLocalisation(tstApp)
|
||||
theList = tstConf.listLanguages(tstConf.LANG_NW)
|
||||
assert theList == [("en_GB", "British English")]
|
||||
@@ -252,7 +252,7 @@ def testBaseConfig_RecentCache(monkeypatch, tmpConf, tmpDir, fncDir):
|
||||
}
|
||||
|
||||
# Remove Non-Existent Entry
|
||||
assert not tmpConf.removeFromRecentCache("dummy")
|
||||
assert not tmpConf.removeFromRecentCache("stuff")
|
||||
assert tmpConf.recentProj == {
|
||||
pathOne: {"time": 1600002000, "title": "Proj One", "words": 100},
|
||||
pathTwo: {"time": 1600005600, "title": "Proj Two", "words": 200},
|
||||
@@ -490,7 +490,7 @@ def testBaseConfig_Internal(monkeypatch, tmpConf):
|
||||
cnfParse = configparser.ConfigParser()
|
||||
cnfParse.read_string(
|
||||
"[Main]\n"
|
||||
"val_string = dummy\n"
|
||||
"val_string = stuff\n"
|
||||
"val_int = 123\n"
|
||||
"val_bool = True\n"
|
||||
"val_list_string = A, B, C\n"
|
||||
@@ -499,7 +499,7 @@ def testBaseConfig_Internal(monkeypatch, tmpConf):
|
||||
|
||||
assert tmpConf._parseLine(
|
||||
cnfParse, "Main", "val_string", tmpConf.CNF_STR, "default"
|
||||
) == "dummy"
|
||||
) == "stuff"
|
||||
assert tmpConf._parseLine(
|
||||
cnfParse, "Main", "nope", tmpConf.CNF_STR, "default"
|
||||
) == "default"
|
||||
@@ -554,7 +554,7 @@ def testBaseConfig_Internal(monkeypatch, tmpConf):
|
||||
assert tmpConf.hasEnchant is False
|
||||
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr("shutil.which", lambda *args: "dummy")
|
||||
mp.setattr("shutil.which", lambda *args: "stuff")
|
||||
tmpConf._checkOptionalPackages()
|
||||
assert tmpConf.hasAssistant is True
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import pytest
|
||||
|
||||
from PyQt5.QtWidgets import qApp
|
||||
|
||||
from dummy import causeException
|
||||
from mock import causeException
|
||||
|
||||
from nw.error import NWErrorMessage, exceptionHandler
|
||||
|
||||
|
||||
@@ -25,19 +25,19 @@ import pytest
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from dummy import DummyMain
|
||||
from mock import MockGuiMain
|
||||
|
||||
@pytest.mark.base
|
||||
def testBaseInit_Launch(caplog, monkeypatch, tmpDir):
|
||||
"""Check launching the main GUI.
|
||||
"""
|
||||
monkeypatch.setattr("nw.guimain.GuiMain", DummyMain)
|
||||
monkeypatch.setattr("nw.guimain.GuiMain", MockGuiMain)
|
||||
|
||||
# Testmode launch
|
||||
nwGUI = nw.main(
|
||||
["--testmode", "--config=%s" % tmpDir, "--data=%s" % tmpDir]
|
||||
)
|
||||
assert isinstance(nwGUI, DummyMain)
|
||||
assert isinstance(nwGUI, MockGuiMain)
|
||||
|
||||
# Darwin launch
|
||||
monkeypatch.setitem(sys.modules, "Foundation", None)
|
||||
@@ -46,7 +46,7 @@ def testBaseInit_Launch(caplog, monkeypatch, tmpDir):
|
||||
nwGUI = nw.main(
|
||||
["--testmode", "--config=%s" % tmpDir, "--data=%s" % tmpDir]
|
||||
)
|
||||
assert isinstance(nwGUI, DummyMain)
|
||||
assert isinstance(nwGUI, MockGuiMain)
|
||||
assert "Foundation" in caplog.messages[1]
|
||||
nw.CONFIG.osDarwin = osDarwin
|
||||
|
||||
@@ -68,7 +68,7 @@ def testBaseInit_Launch(caplog, monkeypatch, tmpDir):
|
||||
def testBaseInit_Options(monkeypatch, tmpDir):
|
||||
"""Test command line options for logging level.
|
||||
"""
|
||||
monkeypatch.setattr("nw.guimain.GuiMain", DummyMain)
|
||||
monkeypatch.setattr("nw.guimain.GuiMain", MockGuiMain)
|
||||
monkeypatch.setattr(sys, "argv", [
|
||||
"novelWriter.py", "--testmode", "--config=%s" % tmpDir, "--data=%s" % tmpDir
|
||||
])
|
||||
@@ -140,7 +140,7 @@ def testBaseInit_Options(monkeypatch, tmpDir):
|
||||
def testBaseInit_Imports(caplog, monkeypatch, tmpDir):
|
||||
"""Check import error handling.
|
||||
"""
|
||||
monkeypatch.setattr("nw.guimain.GuiMain", DummyMain)
|
||||
monkeypatch.setattr("nw.guimain.GuiMain", MockGuiMain)
|
||||
monkeypatch.setattr("PyQt5.QtWidgets.QApplication.__init__", lambda *args: None)
|
||||
monkeypatch.setattr("PyQt5.QtWidgets.QApplication.exec_", lambda *args: 0)
|
||||
monkeypatch.setattr("PyQt5.QtWidgets.QErrorMessage.__init__", lambda *args: None)
|
||||
|
||||
Reference in New Issue
Block a user