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
+4 -3
View File
@@ -29,6 +29,7 @@ from zipfile import ZipFile
from mock import causeOSError
from tools import C, cmpFiles, writeFile, buildTestProject, XML_IGNORE
from novelwriter import CONFIG
from novelwriter.enum import nwItemClass, nwItemType, nwItemLayout
from novelwriter.common import formatTimeStamp
from novelwriter.constants import nwFiles
@@ -721,17 +722,17 @@ def testCoreProject_Backup(monkeypatch, mockGUI, fncPath, tstPaths):
# ================
# Invalid path
theProject.mainConf._backupPath = None
CONFIG._backupPath = None
assert theProject.backupProject(doNotify=False) is False
# Missing project name
theProject.mainConf._backupPath = tstPaths.tmpDir
CONFIG._backupPath = tstPaths.tmpDir
theProject.data.setName("")
assert theProject.backupProject(doNotify=False) is False
# Valid Settings
# ==============
theProject.mainConf._backupPath = tstPaths.tmpDir
CONFIG._backupPath = tstPaths.tmpDir
theProject.data.setName("Test Minimal")
# Can't make folder
+4 -3
View File
@@ -25,6 +25,7 @@ import pytest
from mock import causeOSError
from tools import C, buildTestProject, writeFile
from novelwriter import CONFIG
from novelwriter.constants import nwFiles
from novelwriter.core.project import NWProject
from novelwriter.core.storage import NWStorage
@@ -148,9 +149,9 @@ def testCoreStorage_LockFile(monkeypatch, fncPath):
# Successful read
assert storage.readLockFile() == [
storage.mainConf.hostName,
storage.mainConf.osType,
storage.mainConf.kernelVer,
CONFIG.hostName,
CONFIG.osType,
CONFIG.kernelVer,
"1000",
]