Remove code for mocking CONFIG object and instead reset it for each test
This commit is contained in:
@@ -37,12 +37,9 @@ KEY_DELAY = 1
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testDlgPreferences_Main(qtbot, monkeypatch, nwGUI, fncPath, tstPaths):
|
||||
def testDlgPreferences_Main(qtbot, monkeypatch, nwGUI, tstPaths):
|
||||
"""Test the load project wizard.
|
||||
"""
|
||||
theConf = nwGUI.mainConf
|
||||
assert theConf._confPath == fncPath
|
||||
|
||||
monkeypatch.setattr(GuiPreferences, "exec_", lambda *a: None)
|
||||
monkeypatch.setattr(GuiPreferences, "result", lambda *a: QDialog.Accepted)
|
||||
monkeypatch.setattr(nwGUI.docEditor.spEnchant, "listDictionaries", lambda: [("en", "none")])
|
||||
@@ -58,7 +55,6 @@ def testDlgPreferences_Main(qtbot, monkeypatch, nwGUI, fncPath, tstPaths):
|
||||
nwPrefs = getGuiItem("GuiPreferences")
|
||||
assert isinstance(nwPrefs, GuiPreferences)
|
||||
nwPrefs.show()
|
||||
assert nwPrefs.mainConf._confPath == fncPath
|
||||
|
||||
assert nwPrefs.updateTheme is False
|
||||
assert nwPrefs.updateSyntax is False
|
||||
@@ -216,7 +212,7 @@ def testDlgPreferences_Main(qtbot, monkeypatch, nwGUI, fncPath, tstPaths):
|
||||
nwPrefs._doClose()
|
||||
|
||||
assert nwGUI.mainConf.saveConfig()
|
||||
projFile = fncPath / "novelwriter.conf"
|
||||
projFile = tstPaths.cnfDir / "novelwriter.conf"
|
||||
testFile = tstPaths.outDir / "guiPreferences_novelwriter.conf"
|
||||
compFile = tstPaths.refDir / "guiPreferences_novelwriter.conf"
|
||||
copyfile(projFile, testFile)
|
||||
|
||||
@@ -91,7 +91,7 @@ def testDlgProjSettings_Main(qtbot, monkeypatch, nwGUI, fncPath, projPath, mockR
|
||||
# Create new project
|
||||
buildTestProject(nwGUI, projPath)
|
||||
mockRnd.reset()
|
||||
nwGUI.mainConf.backupPath = fncPath
|
||||
nwGUI.mainConf.setBackupPath(fncPath)
|
||||
|
||||
# Set some values
|
||||
theProject = nwGUI.theProject
|
||||
@@ -156,7 +156,7 @@ def testDlgProjSettings_StatusImport(qtbot, monkeypatch, nwGUI, fncPath, projPat
|
||||
# Create new project
|
||||
mockRnd.reset()
|
||||
buildTestProject(nwGUI, projPath)
|
||||
nwGUI.mainConf.backupPath = fncPath
|
||||
nwGUI.mainConf.setBackupPath(fncPath)
|
||||
|
||||
# Set some values
|
||||
theProject = nwGUI.theProject
|
||||
@@ -357,7 +357,7 @@ def testDlgProjSettings_Replace(qtbot, monkeypatch, nwGUI, fncPath, projPath, mo
|
||||
# Create new project
|
||||
mockRnd.reset()
|
||||
buildTestProject(nwGUI, projPath)
|
||||
nwGUI.mainConf.backupPath = fncPath
|
||||
nwGUI.mainConf.setBackupPath(fncPath)
|
||||
|
||||
# Set some values
|
||||
theProject = nwGUI.theProject
|
||||
|
||||
Reference in New Issue
Block a user