Remove dependency on .mainConf class variable in tests

This commit is contained in:
Veronica Berglyd Olsen
2023-05-16 00:40:56 +02:00
parent cdb501ae26
commit 7f8ffb228e
14 changed files with 67 additions and 54 deletions
+2 -1
View File
@@ -30,6 +30,7 @@ from PyQt5.QtWidgets import (
QDialogButtonBox, QDialog, QAction, QFileDialog, QFontDialog
)
from novelwriter import CONFIG
from novelwriter.dialogs.quotes import GuiQuoteSelect
from novelwriter.dialogs.preferences import GuiPreferences
@@ -211,7 +212,7 @@ def testDlgPreferences_Main(qtbot, monkeypatch, nwGUI, tstPaths):
qtbot.mouseClick(nwPrefs.buttonBox.button(QDialogButtonBox.Ok), Qt.LeftButton)
nwPrefs._doClose()
assert nwGUI.mainConf.saveConfig()
assert CONFIG.saveConfig()
projFile = tstPaths.cnfDir / "novelwriter.conf"
testFile = tstPaths.outDir / "guiPreferences_novelwriter.conf"
compFile = tstPaths.refDir / "guiPreferences_novelwriter.conf"
+5 -4
View File
@@ -21,13 +21,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
import pytest
from novelwriter.enum import nwItemType
from tools import C, getGuiItem, buildTestProject
from PyQt5.QtGui import QColor
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog, QAction, QColorDialog
from novelwriter import CONFIG
from novelwriter.enum import nwItemType
from novelwriter.dialogs.editlabel import GuiEditLabel
from novelwriter.dialogs.projsettings import GuiProjectSettings
@@ -91,7 +92,7 @@ def testDlgProjSettings_Main(qtbot, monkeypatch, nwGUI, fncPath, projPath, mockR
# Create new project
buildTestProject(nwGUI, projPath)
mockRnd.reset()
nwGUI.mainConf.setBackupPath(fncPath)
CONFIG.setBackupPath(fncPath)
# Set some values
theProject = nwGUI.theProject
@@ -156,7 +157,7 @@ def testDlgProjSettings_StatusImport(qtbot, monkeypatch, nwGUI, fncPath, projPat
# Create new project
mockRnd.reset()
buildTestProject(nwGUI, projPath)
nwGUI.mainConf.setBackupPath(fncPath)
CONFIG.setBackupPath(fncPath)
# Set some values
theProject = nwGUI.theProject
@@ -357,7 +358,7 @@ def testDlgProjSettings_Replace(qtbot, monkeypatch, nwGUI, fncPath, projPath, mo
# Create new project
mockRnd.reset()
buildTestProject(nwGUI, projPath)
nwGUI.mainConf.setBackupPath(fncPath)
CONFIG.setBackupPath(fncPath)
# Set some values
theProject = nwGUI.theProject