Switch test code to PyQt6
This commit is contained in:
@@ -25,8 +25,8 @@ from zipfile import ZipFile
|
||||
import enchant
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
from PyQt5.QtWidgets import QFileDialog
|
||||
from PyQt6.QtGui import QDesktopServices
|
||||
from PyQt6.QtWidgets import QFileDialog
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.tools.dictionaries import GuiDictionaries
|
||||
|
||||
@@ -22,7 +22,7 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtWidgets import QAction
|
||||
from PyQt6.QtGui import QAction
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.enum import nwDocInsert
|
||||
|
||||
@@ -24,9 +24,9 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QUrl
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
from PyQt5.QtWidgets import QFileDialog, QListWidgetItem, QMessageBox
|
||||
from PyQt6.QtCore import QUrl
|
||||
from PyQt6.QtGui import QDesktopServices
|
||||
from PyQt6.QtWidgets import QFileDialog, QListWidgetItem, QMessageBox
|
||||
from pytestqt.qtbot import QtBot
|
||||
|
||||
from novelwriter.constants import nwLabels
|
||||
|
||||
@@ -26,10 +26,10 @@ from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QUrl, pyqtSlot
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
from PyQt5.QtPrintSupport import QPrintPreviewDialog
|
||||
from PyQt5.QtWidgets import QAction, QListWidgetItem
|
||||
from PyQt6.QtCore import QUrl, pyqtSlot
|
||||
from PyQt6.QtGui import QAction, QDesktopServices
|
||||
from PyQt6.QtPrintSupport import QPrintPreviewDialog
|
||||
from PyQt6.QtWidgets import QListWidgetItem
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.constants import nwHeadFmt
|
||||
|
||||
@@ -22,9 +22,9 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import pyqtSlot
|
||||
from PyQt5.QtGui import QFont
|
||||
from PyQt5.QtWidgets import QFontDialog
|
||||
from PyQt6.QtCore import pyqtSlot
|
||||
from PyQt6.QtGui import QFont
|
||||
from PyQt6.QtWidgets import QFontDialog
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.common import describeFont
|
||||
|
||||
@@ -22,7 +22,7 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtWidgets import QAction
|
||||
from PyQt6.QtGui import QAction
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.enum import nwItemClass
|
||||
|
||||
@@ -25,8 +25,9 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QPoint
|
||||
from PyQt5.QtWidgets import QAction, QFileDialog, QMenu
|
||||
from PyQt6.QtCore import QPoint
|
||||
from PyQt6.QtGui import QAction
|
||||
from PyQt6.QtWidgets import QFileDialog, QMenu
|
||||
from pytestqt.qtbot import QtBot
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
@@ -162,6 +163,7 @@ def testToolWelcome_Open(qtbot: QtBot, monkeypatch, nwGUI, fncPath):
|
||||
welcome.close()
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
@pytest.mark.gui
|
||||
def testToolWelcome_New(qtbot: QtBot, caplog, monkeypatch, nwGUI, fncPath):
|
||||
"""Test the new project tab in the Welcome window."""
|
||||
|
||||
@@ -24,7 +24,9 @@ import json
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtWidgets import QAction, QFileDialog
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QAction
|
||||
from PyQt6.QtWidgets import QFileDialog
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.constants import nwFiles
|
||||
@@ -117,7 +119,7 @@ def testToolWritingStats_Export(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
||||
assert not sessLog._saveData(None) # type: ignore
|
||||
|
||||
# Sort by time
|
||||
sessLog.listBox.sortByColumn(sessLog.C_TIME, 0) # type: ignore
|
||||
sessLog.listBox.sortByColumn(sessLog.C_TIME, Qt.SortOrder.AscendingOrder)
|
||||
|
||||
assert sessLog.novelWords.text() == "{:n}".format(600)
|
||||
assert sessLog.notesWords.text() == "{:n}".format(275)
|
||||
@@ -201,7 +203,7 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
||||
]
|
||||
sessFile.write_text("".join(data), encoding="utf-8")
|
||||
sessLog.populateGUI()
|
||||
sessLog.listBox.sortByColumn(sessLog.C_TIME, 0) # type: ignore
|
||||
sessLog.listBox.sortByColumn(sessLog.C_TIME, Qt.SortOrder.AscendingOrder)
|
||||
|
||||
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
|
||||
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-200)
|
||||
|
||||
Reference in New Issue
Block a user