Fix tests

This commit is contained in:
Veronica K. B. Olsen
2021-02-16 23:58:25 +01:00
parent 62cc64d912
commit 4033f7a47d
4 changed files with 14 additions and 8 deletions
+1
View File
@@ -2,6 +2,7 @@ SOURCES += \
nw/constants/constants.py \
nw/core/document.py \
nw/core/project.py \
nw/core/tokenizer.py \
nw/gui/about.py \
nw/gui/build.py \
nw/gui/custom.py \
+3 -5
View File
@@ -1250,16 +1250,14 @@ class NWProject():
"""
if theLang is None:
theLang = self.mainConf.spellLanguage
if theLang is None:
theLang = "en"
lngShort = theLang.split("_")[0]
loadFile = os.path.join(self.mainConf.langPath, "project_en.json")
chkFile1 = os.path.join(self.mainConf.langPath, "project_%s.json" % theLang)
chkFile2 = os.path.join(self.mainConf.langPath, "project_%s.json" % lngShort)
print(theLang)
print(lngShort)
print(loadFile)
print(chkFile1)
print(chkFile2)
if os.path.isfile(chkFile1):
loadFile = chkFile1
elif os.path.isfile(chkFile2):
+3 -1
View File
@@ -28,8 +28,9 @@ import logging
import re
from operator import itemgetter
from functools import partial
from PyQt5.QtCore import QRegularExpression
from PyQt5.QtCore import QCoreApplication, QRegularExpression
from nw.core.document import NWDoc
from nw.core.tools import numberToRoman
@@ -144,6 +145,7 @@ class Tokenizer():
# Function Mapping
self._localLookup = self.theProject.localLookup
self.tr = partial(QCoreApplication.translate, "Tokenizer")
return
+7 -2
View File
@@ -112,11 +112,14 @@ def testCoreToken_Setters(dummyGUI):
# END Test testCoreToken_Setters
@pytest.mark.core
def testCoreToken_TextOps(monkeypatch, nwMinimal, dummyGUI):
def testCoreToken_TextOps(monkeypatch, nwMinimal, dummyGUI, tmpConf):
"""Test handling files and text in the Tokenizer class.
"""
theProject = NWProject(dummyGUI)
theProject.mainConf = tmpConf
theProject.projTree.setSeed(42)
theProject.loadProjectLocalisation("en")
theToken = Tokenizer(theProject, dummyGUI)
theToken.setKeepMarkdown(True)
@@ -408,10 +411,12 @@ def testCoreToken_Tokenize(dummyGUI):
# END Test testCoreToken_Tokenize
@pytest.mark.core
def testCoreToken_Headers(dummyGUI):
def testCoreToken_Headers(dummyGUI, tmpConf):
"""Test the header and page parser of the Tokenizer class.
"""
theProject = NWProject(dummyGUI)
theProject.mainConf = tmpConf
theProject.loadProjectLocalisation("en")
theToken = Tokenizer(theProject, dummyGUI)
# Nothing