Update linting for tests

This commit is contained in:
Veronica Berglyd Olsen
2025-08-27 21:04:32 +02:00
parent 44d117c91d
commit 5bdbd7c195
68 changed files with 78 additions and 101 deletions
+2 -10
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import logging import logging
@@ -70,8 +70,6 @@ def resetConfigVars():
CONFIG.emphLabels = True CONFIG.emphLabels = True
CONFIG.lineHighlight = True CONFIG.lineHighlight = True
return
## ##
# Auto Fixtures # Auto Fixtures
@@ -88,7 +86,6 @@ def sessionFixture():
(_TMP_ROOT / "manual.pdf").touch() (_TMP_ROOT / "manual.pdf").touch()
(_SRC_ROOT / "novelwriter" / "assets"/ "manual.pdf").touch() (_SRC_ROOT / "novelwriter" / "assets"/ "manual.pdf").touch()
(_SRC_ROOT / "novelwriter" / "assets"/ "manual_fr.pdf").touch() (_SRC_ROOT / "novelwriter" / "assets"/ "manual_fr.pdf").touch()
return
@pytest.fixture(scope="function", autouse=True) @pytest.fixture(scope="function", autouse=True)
@@ -107,8 +104,6 @@ def functionFixture(qtbot):
resetConfigVars() resetConfigVars()
logging.getLogger("novelwriter").setLevel(logging.INFO) logging.getLogger("novelwriter").setLevel(logging.INFO)
return
## ##
# Core Test Folders # Core Test Folders
@@ -251,13 +246,11 @@ def prjLipsum():
if dstDir.exists(): if dstDir.exists():
shutil.rmtree(dstDir) shutil.rmtree(dstDir)
return
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def ipsumText(): def ipsumText():
"""Return five paragraphs of Lorem Ipsum text.""" """Return five paragraphs of Lorem Ipsum text."""
thatIpsum = [( return [(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc maximus justo non dictum co" "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc maximus justo non dictum co"
"mmodo. Curabitur lacinia tempor orci vel luctus. Phasellus porta metus eu massa luctus, e" "mmodo. Curabitur lacinia tempor orci vel luctus. Phasellus porta metus eu massa luctus, e"
"get euismod risus rhoncus. Vestibulum sed arcu nisi. Maecenas pretium facilisis velit, ve" "get euismod risus rhoncus. Vestibulum sed arcu nisi. Maecenas pretium facilisis velit, ve"
@@ -305,4 +298,3 @@ def ipsumText():
" a nisl. Etiam eget tristique dui. Nulla sed mi finibus, venenatis tellus non, maximus en" " a nisl. Etiam eget tristique dui. Nulla sed mi finibus, venenatis tellus non, maximus en"
"im." "im."
)] )]
return thatIpsum
+3 -4
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from unittest.mock import MagicMock from unittest.mock import MagicMock
@@ -35,7 +35,6 @@ class MockGuiMain(QWidget):
self.docViewer = MagicMock() self.docViewer = MagicMock()
self.mainProgress = MagicMock() self.mainProgress = MagicMock()
self.projPath = "" self.projPath = ""
return
def postLaunchTasks(self, cmdOpen): def postLaunchTasks(self, cmdOpen):
return return
@@ -45,7 +44,6 @@ class MockGuiMain(QWidget):
def openProject(self, projPath): def openProject(self, projPath):
self.projPath = projPath self.projPath = projPath
return
def rebuildIndex(self): def rebuildIndex(self):
return return
@@ -64,7 +62,6 @@ class MockTheme:
self.guiFont = QFont() self.guiFont = QFont()
self.guiFontB = QFont() self.guiFontB = QFont()
self.guiFontBU = QFont() self.guiFontBU = QFont()
return
def initThemes(self) -> None: def initThemes(self) -> None:
return return
@@ -96,8 +93,10 @@ class MockApp:
# Mock functions that will raise errors instead. # Mock functions that will raise errors instead.
def causeOSError(*args, **kwargs): def causeOSError(*args, **kwargs):
"""Raise an OSError."""
raise OSError("Mock OSError") raise OSError("Mock OSError")
def causeException(*args, **kwargs): def causeException(*args, **kwargs):
"""Raise an Exception."""
raise Exception("Mock Exception") raise Exception("Mock Exception")
+1 -2
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import time import time
@@ -794,7 +794,6 @@ def testBaseCommon_openExternalPath(monkeypatch, tstPaths):
def mockOpenUrl(url: QUrl) -> None: def mockOpenUrl(url: QUrl) -> None:
nonlocal lastUrl nonlocal lastUrl
lastUrl = url.toString() lastUrl = url.toString()
return
monkeypatch.setattr(QDesktopServices, "openUrl", mockOpenUrl) monkeypatch.setattr(QDesktopServices, "openUrl", mockOpenUrl)
assert openExternalPath(Path("/foo/bar")) is False assert openExternalPath(Path("/foo/bar")) is False
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import datetime import datetime
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import sys import sys
+2 -2
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import logging import logging
@@ -40,7 +40,7 @@ from tests.tools import clearLogHandlers
@pytest.mark.base @pytest.mark.base
def testBaseInit_Launch(caplog, monkeypatch, fncPath): def testBaseInit_Launch(caplog, monkeypatch, fncPath):
"""Check launching the main GUI. This test """ """Check launching the main GUI."""
monkeypatch.setattr(NSplashScreen, "finish", lambda *a: None) monkeypatch.setattr(NSplashScreen, "finish", lambda *a: None)
monkeypatch.setattr("novelwriter.splash.sleep", lambda *a: None) monkeypatch.setattr("novelwriter.splash.sleep", lambda *a: None)
monkeypatch.setattr("novelwriter._createApp", lambda *a: Mock()) monkeypatch.setattr("novelwriter._createApp", lambda *a: Mock())
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from unittest.mock import MagicMock from unittest.mock import MagicMock
+2 -2
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import json import json
@@ -39,7 +39,7 @@ from tests.tools import C, buildTestProject
def isUUID(value): def isUUID(value):
"""Checks if a value is a valid UUID object.""" """Check if a value is a valid UUID object."""
try: try:
uuid.UUID(value) uuid.UUID(value)
return True return True
+1 -2
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import shutil import shutil
@@ -669,7 +669,6 @@ def testCoreTools_ProjectBuilderCopyPlain(monkeypatch, caplog, mockGUI, prjLipsu
@pytest.mark.core @pytest.mark.core
def testCoreTools_ProjectBuilderCopyZipped(monkeypatch, caplog, mockGUI, fncPath, mockRnd): def testCoreTools_ProjectBuilderCopyZipped(monkeypatch, caplog, mockGUI, fncPath, mockRnd):
"""Create a new project copied from existing zipped project.""" """Create a new project copied from existing zipped project."""
# Create a project # Create a project
origPath = fncPath / "original" origPath = fncPath / "original"
srcProject = NWProject() srcProject = NWProject()
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import json import json
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import json import json
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+2 -3
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import copy import copy
@@ -491,8 +491,7 @@ def testCoreItem_LayoutSetter(mockGUI):
@pytest.mark.core @pytest.mark.core
def testCoreItem_ClassDefaults(mockGUI): def testCoreItem_ClassDefaults(mockGUI):
"""Test the setter for the default values. """Test the setter for the default values."""
"""
project = NWProject() project = NWProject()
item = NWItem(project, "0000000000000") item = NWItem(project, "0000000000000")
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import json import json
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from shutil import copyfile from shutil import copyfile
+1 -2
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import json import json
@@ -53,7 +53,6 @@ def mockVersion(monkeypatch):
"""Mock the version info to prevent diff from failing.""" """Mock the version info to prevent diff from failing."""
monkeypatch.setattr("novelwriter.core.projectxml.__version__", "2.7b1") monkeypatch.setattr("novelwriter.core.projectxml.__version__", "2.7b1")
monkeypatch.setattr("novelwriter.core.projectxml.__hexversion__", "0x020700b1") monkeypatch.setattr("novelwriter.core.projectxml.__hexversion__", "0x020700b1")
return
@pytest.mark.core @pytest.mark.core
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from pathlib import Path from pathlib import Path
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import sys import sys
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+2 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import json import json
@@ -40,6 +40,7 @@ from tests.tools import C, buildTestProject
class MockProject: class MockProject:
"""Test class for projects.""" """Test class for projects."""
pass pass
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import random import random
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from pathlib import Path from pathlib import Path
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+2 -2
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
@@ -37,7 +37,7 @@ from tests.tools import buildTestProject
@pytest.mark.gui @pytest.mark.gui
def testDlgWordList_Dialog(qtbot, monkeypatch, nwGUI, fncPath, projPath): def testDlgWordList_Dialog(qtbot, monkeypatch, nwGUI, fncPath, projPath):
"""test the word list editor.""" """Test the word list editor."""
buildTestProject(nwGUI, projPath) buildTestProject(nwGUI, projPath)
monkeypatch.setattr(GuiWordList, "exec", lambda *a: None) monkeypatch.setattr(GuiWordList, "exec", lambda *a: None)
+1 -3
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
@@ -35,11 +35,9 @@ class MockWidget(QWidget):
def __init__(self): def __init__(self):
super().__init__(None) super().__init__(None)
self.count = 0 self.count = 0
return
def wheelEvent(self, event: QWheelEvent) -> None: def wheelEvent(self, event: QWheelEvent) -> None:
self.count += 1 self.count += 1
return
@pytest.mark.gui @pytest.mark.gui
+1 -3
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
@@ -43,12 +43,10 @@ class MockWheelEvent(QWheelEvent):
Qt.ScrollPhase.ScrollUpdate, False Qt.ScrollPhase.ScrollUpdate, False
) )
self.ignored = False self.ignored = False
return
def ignore(self): def ignore(self):
super().ignore() super().ignore()
self.ignored = True self.ignored = True
return
@pytest.mark.gui @pytest.mark.gui
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from time import sleep from time import sleep
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+2 -4
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from urllib.error import HTTPError from urllib.error import HTTPError
@@ -44,7 +44,6 @@ class MockDesktopServices:
@staticmethod @staticmethod
def openUrl(url): def openUrl(url):
MockDesktopServices.url = url MockDesktopServices.url = url
return
class MockData: class MockData:
@@ -61,8 +60,7 @@ class MockPayload:
return return
def read(self): def read(self):
data = MockData() return MockData()
return data
class MockHTTPError: class MockHTTPError:
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import json import json
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from unittest.mock import MagicMock from unittest.mock import MagicMock
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from unittest.mock import MagicMock from unittest.mock import MagicMock
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import shutil import shutil
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import sys import sys
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from unittest.mock import MagicMock from unittest.mock import MagicMock
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from pathlib import Path from pathlib import Path
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import time import time
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from unittest.mock import MagicMock from unittest.mock import MagicMock
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from time import time from time import time
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import time import time
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import json import json
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import re import re
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from zipfile import ZipFile from zipfile import ZipFile
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -2
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from pathlib import Path from pathlib import Path
@@ -143,7 +143,6 @@ def testToolManuscriptBuild_Main(
def mockOpenUrl(url: QUrl) -> None: def mockOpenUrl(url: QUrl) -> None:
nonlocal lastUrl nonlocal lastUrl
lastUrl = url.toString() lastUrl = url.toString()
return
with monkeypatch.context() as mp: with monkeypatch.context() as mp:
mp.setattr(QDesktopServices, "openUrl", mockOpenUrl) mp.setattr(QDesktopServices, "openUrl", mockOpenUrl)
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import sys import sys
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import pytest import pytest
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
from datetime import datetime from datetime import datetime
+1 -1
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import json import json
+2 -6
View File
@@ -17,7 +17,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """ # noqa
from __future__ import annotations from __future__ import annotations
import shutil import shutil
@@ -124,7 +124,7 @@ def xmlToText(xElem):
def readFile(fileName: str | Path): def readFile(fileName: str | Path):
"""Returns the content of a file as a string.""" """Return the content of a file as a string."""
with open(fileName, mode="r", encoding="utf-8") as inFile: with open(fileName, mode="r", encoding="utf-8") as inFile:
return inFile.read() return inFile.read()
@@ -154,8 +154,6 @@ def cleanProject(path: str | Path):
if tocFile.is_file(): if tocFile.is_file():
tocFile.unlink() tocFile.unlink()
return
def clearLogHandlers(): def clearLogHandlers():
"""Clear all log handlers.""" """Clear all log handlers."""
@@ -235,7 +233,6 @@ class SimpleDialog(QDialog):
self.setLayout(layout) self.setLayout(layout)
if widget: if widget:
layout.addWidget(widget) layout.addWidget(widget)
return
@property @property
def widget(self) -> QWidget | None: def widget(self) -> QWidget | None:
@@ -246,4 +243,3 @@ class SimpleDialog(QDialog):
layout = self.layout() layout = self.layout()
assert layout is not None assert layout is not None
layout.addWidget(widget) layout.addWidget(widget)
return