Fix test coverage

This commit is contained in:
Veronica Berglyd Olsen
2025-10-05 17:39:48 +02:00
parent 850976335c
commit 050e3b09ad
3 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -498,7 +498,7 @@ class GuiMain(QMainWindow):
# Check if we need to rebuild the index # Check if we need to rebuild the index
if SHARED.project.index.indexBroken: if SHARED.project.index.indexBroken:
if not SHARED.project.index.indexUpgrade: if not SHARED.project.index.indexUpgrade:
SHARED.info(self.tr("The project index is broken. Rebuilding index.")) SHARED.warn(self.tr("The project index is broken. Rebuilding index."))
self.rebuildIndex() self.rebuildIndex()
# Make sure the changed status is set to false on things opened # Make sure the changed status is set to false on things opened
+4 -3
View File
@@ -32,7 +32,8 @@ from PyQt6.QtCore import Qt
from PyQt6.QtGui import QPalette from PyQt6.QtGui import QPalette
from PyQt6.QtWidgets import QInputDialog, QMessageBox from PyQt6.QtWidgets import QInputDialog, QMessageBox
from novelwriter import CONFIG, SHARED from novelwriter import CONFIG, SHARED, __hexversion__
from novelwriter.common import jsonEncode
from novelwriter.config import DEF_GUI_DARK, DEF_GUI_LIGHT from novelwriter.config import DEF_GUI_DARK, DEF_GUI_LIGHT
from novelwriter.constants import nwFiles from novelwriter.constants import nwFiles
from novelwriter.dialogs.editlabel import GuiEditLabel from novelwriter.dialogs.editlabel import GuiEditLabel
@@ -825,11 +826,11 @@ def testGuiMain_OpenClose(qtbot, monkeypatch, nwGUI, projPath, fncPath, mockRnd)
nwGUI.viewDocument(C.hTitlePage) nwGUI.viewDocument(C.hTitlePage)
# Handle broken index on project open # Handle broken index on project open
idxData = jsonEncode({"novelWriter.meta": {"version": __hexversion__}})
nwGUI.closeProject() nwGUI.closeProject()
idxPath: Path = projPath / "meta" / nwFiles.INDEX_FILE idxPath: Path = projPath / "meta" / nwFiles.INDEX_FILE
assert idxPath.read_text(encoding="utf-8") != "{}" assert idxPath.read_text(encoding="utf-8") != "{}"
idxPath.write_text("{}", encoding="utf-8") idxPath.write_text(idxData, encoding="utf-8")
assert idxPath.read_text(encoding="utf-8") == "{}"
nwGUI.openProject(projPath) nwGUI.openProject(projPath)
nwGUI.saveProject() nwGUI.saveProject()
+1 -1
View File
@@ -67,7 +67,7 @@ def cmpFiles(
fileOne: str | Path, fileOne: str | Path,
fileTwo: str | Path, fileTwo: str | Path,
ignoreLines: list[int] | None = None, ignoreLines: list[int] | None = None,
ignoreStart: tuple[str] | None = None ignoreStart: tuple | None = None
) -> bool: ) -> bool:
"""Compare two files, with optional line ignore.""" """Compare two files, with optional line ignore."""
if ignoreLines is None: if ignoreLines is None: