Add coverage of some missed lines
This commit is contained in:
@@ -25,7 +25,7 @@ import pytest
|
||||
from tools import buildTestProject
|
||||
from mocked import MockGuiMain, MockTheme
|
||||
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
from PyQt5.QtWidgets import QFileDialog, QMessageBox, QWidget
|
||||
|
||||
from novelwriter.shared import SharedData
|
||||
from novelwriter.core.project import NWProject
|
||||
@@ -66,7 +66,7 @@ def testBaseSharedData_Init():
|
||||
|
||||
|
||||
@pytest.mark.base
|
||||
def testBaseSharedData_Projects(fncPath, caplog):
|
||||
def testBaseSharedData_Projects(monkeypatch, caplog, fncPath):
|
||||
"""Test SharedData handling of projects."""
|
||||
project = NWProject()
|
||||
buildTestProject(project, fncPath)
|
||||
@@ -118,6 +118,11 @@ def testBaseSharedData_Projects(fncPath, caplog):
|
||||
assert shared.hasProject is False
|
||||
assert isinstance(shared.projectLock, list)
|
||||
|
||||
# Test browsing for projects
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(QFileDialog, "getOpenFileName", lambda *a, **k: (a[2], ""))
|
||||
assert shared.getProjectPath(QWidget(), fncPath, allowZip=True) == fncPath
|
||||
|
||||
# END Test testBaseSharedData_Projects
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user