Remove encoding line and add spaces between classes and functions, tests

This commit is contained in:
Veronica Berglyd Olsen
2021-06-25 21:04:48 +02:00
parent edfd7c9770
commit 991a61f2f6
41 changed files with 150 additions and 41 deletions
-1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# #
# Configuration file for the Sphinx documentation builder. # Configuration file for the Sphinx documentation builder.
# #
-1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
Qt Base Translation File Qt Base Translation File
======================== ========================
+15 -1
View File
@@ -1,5 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" """
novelWriter Main Setup Script novelWriter Main Setup Script
=============================== ===============================
@@ -35,6 +34,7 @@ OS_LINUX = 1
OS_WIN = 2 OS_WIN = 2
OS_DARWIN = 3 OS_DARWIN = 3
# =============================================================================================== # # =============================================================================================== #
# Utilities # Utilities
# =============================================================================================== # # =============================================================================================== #
@@ -66,6 +66,7 @@ def extractVersion():
return numVers, hexVers return numVers, hexVers
# =============================================================================================== # # =============================================================================================== #
# General # General
# =============================================================================================== # # =============================================================================================== #
@@ -102,6 +103,7 @@ def installPackages(hostOS):
return return
## ##
# Clean Build and Dist Folders (clean) # Clean Build and Dist Folders (clean)
## ##
@@ -140,6 +142,7 @@ def cleanInstall():
return return
# =============================================================================================== # # =============================================================================================== #
# Additional Buiilds # Additional Buiilds
# =============================================================================================== # # =============================================================================================== #
@@ -217,6 +220,7 @@ def buildQtDocs():
return return
## ##
# Qt Linguist QM Builder (qtlrelease) # Qt Linguist QM Builder (qtlrelease)
## ##
@@ -255,6 +259,7 @@ def buildQtI18n():
return return
## ##
# Qt Linguist TS Builder (qtlupdate) # Qt Linguist TS Builder (qtlupdate)
## ##
@@ -278,6 +283,7 @@ def buildQtI18nTS():
return return
## ##
# Sample Project ZIP File Builder (sample) # Sample Project ZIP File Builder (sample)
## ##
@@ -318,6 +324,7 @@ def buildSampleZip():
return return
# =============================================================================================== # # =============================================================================================== #
# Python Packaging # Python Packaging
# =============================================================================================== # # =============================================================================================== #
@@ -429,6 +436,7 @@ def makeMinimalPackage(targetOS):
return return
## ##
# Make Simple Package (pack-pyz) # Make Simple Package (pack-pyz)
## ##
@@ -607,6 +615,7 @@ def makeSimplePackage(embedPython):
return return
# =============================================================================================== # # =============================================================================================== #
# General Installers # General Installers
# =============================================================================================== # # =============================================================================================== #
@@ -754,6 +763,7 @@ def xdgInstall():
return return
## ##
# XDG Uninstallation (xdg-uninstall) # XDG Uninstallation (xdg-uninstall)
## ##
@@ -823,6 +833,7 @@ def xdgUninstall():
return return
## ##
# WIN Installation (win-install) # WIN Installation (win-install)
## ##
@@ -947,6 +958,7 @@ def winInstall():
return return
## ##
# WIN Uninstallation (win-uninstall) # WIN Uninstallation (win-uninstall)
## ##
@@ -1033,6 +1045,7 @@ def winUninstall():
return return
# =============================================================================================== # # =============================================================================================== #
# Windows Installers # Windows Installers
# =============================================================================================== # # =============================================================================================== #
@@ -1070,6 +1083,7 @@ def innoSetup():
return return
# =============================================================================================== # # =============================================================================================== #
# Process Command Line # Process Command Line
# =============================================================================================== # # =============================================================================================== #
+13 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Test Suite Configuration novelWriter Test Suite Configuration
====================================== ======================================
@@ -34,6 +33,7 @@ import nw # noqa: E402
from nw.config import Config # noqa: E402 from nw.config import Config # noqa: E402
## ##
# Core Test Folders # Core Test Folders
## ##
@@ -52,6 +52,7 @@ def tmpDir():
os.mkdir(theDir) os.mkdir(theDir)
return theDir return theDir
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def refDir(): def refDir():
"""The folder where all the reference files are stored for verifying """The folder where all the reference files are stored for verifying
@@ -61,6 +62,7 @@ def refDir():
theDir = os.path.join(testDir, "reference") theDir = os.path.join(testDir, "reference")
return theDir return theDir
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def filesDir(): def filesDir():
"""The folder where additional test files are stored. """The folder where additional test files are stored.
@@ -69,6 +71,7 @@ def filesDir():
theDir = os.path.join(testDir, "files") theDir = os.path.join(testDir, "files")
return theDir return theDir
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def outDir(tmpDir): def outDir(tmpDir):
"""An output folder for test results """An output folder for test results
@@ -78,6 +81,7 @@ def outDir(tmpDir):
os.mkdir(theDir) os.mkdir(theDir)
return theDir return theDir
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def fncDir(tmpDir): def fncDir(tmpDir):
"""A temporary folder for a single test function. """A temporary folder for a single test function.
@@ -92,6 +96,7 @@ def fncDir(tmpDir):
shutil.rmtree(fncDir) shutil.rmtree(fncDir)
return return
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def fncProj(fncDir): def fncProj(fncDir):
"""A temporary folder for a single test function, """A temporary folder for a single test function,
@@ -104,6 +109,7 @@ def fncProj(fncDir):
os.mkdir(prjDir) os.mkdir(prjDir)
return prjDir return prjDir
## ##
# novelWriter Objects # novelWriter Objects
## ##
@@ -121,6 +127,7 @@ def tmpConf(tmpDir):
theConf.guiLang = "en_GB" theConf.guiLang = "en_GB"
return theConf return theConf
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def fncConf(fncDir): def fncConf(fncDir):
"""Create a temporary novelWriter configuration object. """Create a temporary novelWriter configuration object.
@@ -134,6 +141,7 @@ def fncConf(fncDir):
theConf.guiLang = "en_GB" theConf.guiLang = "en_GB"
return theConf return theConf
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def dummyGUI(monkeypatch, tmpConf): def dummyGUI(monkeypatch, tmpConf):
"""Create a mock instance of novelWriter's main GUI class. """Create a mock instance of novelWriter's main GUI class.
@@ -143,6 +151,7 @@ def dummyGUI(monkeypatch, tmpConf):
theGui.mainConf = tmpConf theGui.mainConf = tmpConf
return theGui return theGui
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def nwGUI(qtbot, monkeypatch, fncDir, fncConf): def nwGUI(qtbot, monkeypatch, fncDir, fncConf):
"""Create an instance of the novelWriter GUI. """Create an instance of the novelWriter GUI.
@@ -164,6 +173,7 @@ def nwGUI(qtbot, monkeypatch, fncDir, fncConf):
return return
## ##
# Temp Project Folders # Temp Project Folders
## ##
@@ -188,6 +198,7 @@ def nwMinimal(tmpDir):
return return
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def nwLipsum(tmpDir): def nwLipsum(tmpDir):
"""A medium sized novelWriter example project with a lot of Lorem """A medium sized novelWriter example project with a lot of Lorem
@@ -209,6 +220,7 @@ def nwLipsum(tmpDir):
return return
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def nwOldProj(tmpDir): def nwOldProj(tmpDir):
"""A minimal movelWriter project using the old folder structure used """A minimal movelWriter project using the old folder structure used
+5 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Test Suite Mocked Classes novelWriter Test Suite Mocked Classes
======================================= =======================================
@@ -20,6 +19,7 @@ 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/>.
""" """
# =========================================================================== # # =========================================================================== #
# Mock GUI # Mock GUI
# =========================================================================== # # =========================================================================== #
@@ -79,6 +79,7 @@ class MockGuiMain():
# END Class MockGuiMain # END Class MockGuiMain
class MockStatusBar(): class MockStatusBar():
def __init__(self): def __init__(self):
@@ -92,6 +93,7 @@ class MockStatusBar():
# END Class MockStatusBar # END Class MockStatusBar
class MockApp: class MockApp:
def __init__(self): def __init__(self):
@@ -102,6 +104,7 @@ class MockApp:
# END Class MockApp # END Class MockApp
# =========================================================================== # # =========================================================================== #
# Error Functions # Error Functions
# Mock functions that will raise errors instead. # Mock functions that will raise errors instead.
@@ -110,5 +113,6 @@ class MockApp:
def causeOSError(*args, **kwargs): def causeOSError(*args, **kwargs):
raise OSError("OSError") raise OSError("OSError")
def causeException(*args, **kwargs): def causeException(*args, **kwargs):
raise Exception("Exception") raise Exception("Exception")
+17 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Common Functions Tester novelWriter Common Functions Tester
===================================== =====================================
@@ -30,6 +29,7 @@ from nw.common import (
isItemLayout, numberToRoman isItemLayout, numberToRoman
) )
@pytest.mark.base @pytest.mark.base
def testBaseCommon_CheckString(): def testBaseCommon_CheckString():
"""Test the checkString function. """Test the checkString function.
@@ -44,6 +44,7 @@ def testBaseCommon_CheckString():
# END Test testBaseCommon_CheckString # END Test testBaseCommon_CheckString
@pytest.mark.base @pytest.mark.base
def testBaseCommon_CheckInt(): def testBaseCommon_CheckInt():
"""Test the checkInt function. """Test the checkInt function.
@@ -57,6 +58,7 @@ def testBaseCommon_CheckInt():
# END Test testBaseCommon_CheckInt # END Test testBaseCommon_CheckInt
@pytest.mark.base @pytest.mark.base
def testBaseCommon_CheckBool(): def testBaseCommon_CheckBool():
"""Test the checkBool function. """Test the checkBool function.
@@ -75,6 +77,7 @@ def testBaseCommon_CheckBool():
# END Test testBaseCommon_CheckBool # END Test testBaseCommon_CheckBool
@pytest.mark.base @pytest.mark.base
def testBaseCommon_CheckHandle(): def testBaseCommon_CheckHandle():
"""Test the checkHandle function. """Test the checkHandle function.
@@ -88,6 +91,7 @@ def testBaseCommon_CheckHandle():
# END Test testBaseCommon_CheckHandle # END Test testBaseCommon_CheckHandle
@pytest.mark.base @pytest.mark.base
def testBaseCommon_IsHandle(): def testBaseCommon_IsHandle():
"""Test the isHandle function. """Test the isHandle function.
@@ -102,6 +106,7 @@ def testBaseCommon_IsHandle():
# END Test testBaseCommon_IsHandle # END Test testBaseCommon_IsHandle
@pytest.mark.base @pytest.mark.base
def testBaseCommon_IsTitleTag(): def testBaseCommon_IsTitleTag():
"""Test the isItemClass function. """Test the isItemClass function.
@@ -119,6 +124,7 @@ def testBaseCommon_IsTitleTag():
# END Test testBaseCommon_IsTitleTag # END Test testBaseCommon_IsTitleTag
@pytest.mark.base @pytest.mark.base
def testBaseCommon_IsItemClass(): def testBaseCommon_IsItemClass():
"""Test the isItemClass function. """Test the isItemClass function.
@@ -141,6 +147,7 @@ def testBaseCommon_IsItemClass():
# END Test testBaseCommon_IsItemClass # END Test testBaseCommon_IsItemClass
@pytest.mark.base @pytest.mark.base
def testBaseCommon_IsItemType(): def testBaseCommon_IsItemType():
"""Test the isItemType function. """Test the isItemType function.
@@ -157,6 +164,7 @@ def testBaseCommon_IsItemType():
# END Test testBaseCommon_IsItemType # END Test testBaseCommon_IsItemType
@pytest.mark.base @pytest.mark.base
def testBaseCommon_IsItemLayout(): def testBaseCommon_IsItemLayout():
"""Test the isItemLayout function. """Test the isItemLayout function.
@@ -177,6 +185,7 @@ def testBaseCommon_IsItemLayout():
# END Test testBaseCommon_IsItemLayout # END Test testBaseCommon_IsItemLayout
@pytest.mark.base @pytest.mark.base
def testBaseCommon_HexToInt(): def testBaseCommon_HexToInt():
"""Test the hexToInt function. """Test the hexToInt function.
@@ -190,6 +199,7 @@ def testBaseCommon_HexToInt():
# END Test testBaseCommon_HexToInt # END Test testBaseCommon_HexToInt
@pytest.mark.base @pytest.mark.base
def testBaseCommon_FormatTimeStamp(): def testBaseCommon_FormatTimeStamp():
"""Test the formatTimeStamp function. """Test the formatTimeStamp function.
@@ -200,6 +210,7 @@ def testBaseCommon_FormatTimeStamp():
# END Test testBaseCommon_FormatTimeStamp # END Test testBaseCommon_FormatTimeStamp
@pytest.mark.base @pytest.mark.base
def testBaseCommon_FormatTime(): def testBaseCommon_FormatTime():
"""Test the formatTime function. """Test the formatTime function.
@@ -222,6 +233,7 @@ def testBaseCommon_FormatTime():
# END Test testBaseCommon_FormatTime # END Test testBaseCommon_FormatTime
@pytest.mark.base @pytest.mark.base
def testBaseCommon_FormatInt(): def testBaseCommon_FormatInt():
"""Test the formatInt function. """Test the formatInt function.
@@ -237,6 +249,7 @@ def testBaseCommon_FormatInt():
# END Test testBaseCommon_FormatInt # END Test testBaseCommon_FormatInt
@pytest.mark.base @pytest.mark.base
def testBaseCommon_TransferCase(): def testBaseCommon_TransferCase():
"""Test the transferCase function. """Test the transferCase function.
@@ -251,6 +264,7 @@ def testBaseCommon_TransferCase():
# END Test testBaseCommon_TransferCase # END Test testBaseCommon_TransferCase
@pytest.mark.base @pytest.mark.base
def testBaseCommon_FuzzyTime(): def testBaseCommon_FuzzyTime():
"""Test the fuzzyTime function. """Test the fuzzyTime function.
@@ -286,6 +300,7 @@ def testBaseCommon_FuzzyTime():
# END Test testBaseCommon_FuzzyTime # END Test testBaseCommon_FuzzyTime
@pytest.mark.base @pytest.mark.base
def testBaseCommon_MakeFileNameSafe(): def testBaseCommon_MakeFileNameSafe():
"""Test the fuzzyTime function. """Test the fuzzyTime function.
@@ -297,6 +312,7 @@ def testBaseCommon_MakeFileNameSafe():
# END Test testBaseCommon_MakeFileNameSafe # END Test testBaseCommon_MakeFileNameSafe
@pytest.mark.core @pytest.mark.core
def testBaseCommon_RomanNumbers(): def testBaseCommon_RomanNumbers():
"""Test conversion of integers to Roman numbers. """Test conversion of integers to Roman numbers.
+6 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Config Class Tester novelWriter Config Class Tester
================================= =================================
@@ -33,6 +32,7 @@ from tools import cmpFiles, writeFile
from nw.config import Config from nw.config import Config
from nw.constants import nwConst, nwFiles from nw.constants import nwConst, nwFiles
@pytest.mark.base @pytest.mark.base
def testBaseConfig_Constructor(monkeypatch): def testBaseConfig_Constructor(monkeypatch):
"""Test config contructor. """Test config contructor.
@@ -79,6 +79,7 @@ def testBaseConfig_Constructor(monkeypatch):
# END Test testBaseConfig_Constructor # END Test testBaseConfig_Constructor
@pytest.mark.base @pytest.mark.base
def testBaseConfig_Init(monkeypatch, tmpDir, fncDir, outDir, refDir, filesDir): def testBaseConfig_Init(monkeypatch, tmpDir, fncDir, outDir, refDir, filesDir):
"""Test config intialisation. """Test config intialisation.
@@ -205,6 +206,7 @@ def testBaseConfig_Init(monkeypatch, tmpDir, fncDir, outDir, refDir, filesDir):
# END Test testBaseConfig_Init # END Test testBaseConfig_Init
@pytest.mark.base @pytest.mark.base
def testBaseConfig_RecentCache(monkeypatch, tmpConf, tmpDir, fncDir): def testBaseConfig_RecentCache(monkeypatch, tmpConf, tmpDir, fncDir):
"""Test recent cache file. """Test recent cache file.
@@ -266,6 +268,7 @@ def testBaseConfig_RecentCache(monkeypatch, tmpConf, tmpDir, fncDir):
# END Test testBaseConfig_RecentCache # END Test testBaseConfig_RecentCache
@pytest.mark.base @pytest.mark.base
def testBaseConfig_SetPath(tmpConf, tmpDir): def testBaseConfig_SetPath(tmpConf, tmpDir):
"""Test path setters. """Test path setters.
@@ -297,6 +300,7 @@ def testBaseConfig_SetPath(tmpConf, tmpDir):
# END Test testBaseConfig_SetPath # END Test testBaseConfig_SetPath
@pytest.mark.base @pytest.mark.base
def testBaseConfig_SettersGetters(tmpConf, tmpDir, outDir, refDir): def testBaseConfig_SettersGetters(tmpConf, tmpDir, outDir, refDir):
"""Set various sizes and positions """Set various sizes and positions
@@ -470,6 +474,7 @@ def testBaseConfig_SettersGetters(tmpConf, tmpDir, outDir, refDir):
# END Test testBaseConfig_SettersGetters # END Test testBaseConfig_SettersGetters
@pytest.mark.base @pytest.mark.base
def testBaseConfig_Internal(monkeypatch, tmpConf): def testBaseConfig_Internal(monkeypatch, tmpConf):
"""Check internal functions. """Check internal functions.
+2 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Error Handler Tester novelWriter Error Handler Tester
================================== ==================================
@@ -29,6 +28,7 @@ from mock import causeException
from nw.error import NWErrorMessage, exceptionHandler from nw.error import NWErrorMessage, exceptionHandler
@pytest.mark.base @pytest.mark.base
def testBaseError_Dialog(qtbot, monkeypatch, fncDir, tmpDir): def testBaseError_Dialog(qtbot, monkeypatch, fncDir, tmpDir):
"""Test the error dialog. """Test the error dialog.
@@ -71,6 +71,7 @@ def testBaseError_Dialog(qtbot, monkeypatch, fncDir, tmpDir):
# END Test testBaseError_Dialog # END Test testBaseError_Dialog
@pytest.mark.base @pytest.mark.base
def testBaseError_Handler(qtbot, monkeypatch, fncDir, tmpDir): def testBaseError_Handler(qtbot, monkeypatch, fncDir, tmpDir):
"""Test the error handler. This test doesn'thave any asserts, but it """Test the error handler. This test doesn'thave any asserts, but it
+3 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Main Init Tester novelWriter Main Init Tester
============================== ==============================
@@ -27,6 +26,7 @@ import sys
from mock import MockGuiMain from mock import MockGuiMain
@pytest.mark.base @pytest.mark.base
def testBaseInit_Launch(caplog, monkeypatch, tmpDir): def testBaseInit_Launch(caplog, monkeypatch, tmpDir):
"""Check launching the main GUI. """Check launching the main GUI.
@@ -64,6 +64,7 @@ def testBaseInit_Launch(caplog, monkeypatch, tmpDir):
# END Test testBaseInit_Launch # END Test testBaseInit_Launch
@pytest.mark.base @pytest.mark.base
def testBaseInit_Options(monkeypatch, tmpDir): def testBaseInit_Options(monkeypatch, tmpDir):
"""Test command line options for logging level. """Test command line options for logging level.
@@ -136,6 +137,7 @@ def testBaseInit_Options(monkeypatch, tmpDir):
# END Test testBaseInit_Options # END Test testBaseInit_Options
@pytest.mark.base @pytest.mark.base
def testBaseInit_Imports(caplog, monkeypatch, tmpDir): def testBaseInit_Imports(caplog, monkeypatch, tmpDir):
"""Check import error handling. """Check import error handling.
+2 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter NWDoc Class Tester novelWriter NWDoc Class Tester
================================ ================================
@@ -28,6 +27,7 @@ from mock import causeOSError
from nw.core import NWProject, NWDoc from nw.core import NWProject, NWDoc
from nw.enum import nwItemClass, nwItemLayout from nw.enum import nwItemClass, nwItemLayout
@pytest.mark.core @pytest.mark.core
def testCoreDocument_LoadSave(monkeypatch, dummyGUI, nwMinimal): def testCoreDocument_LoadSave(monkeypatch, dummyGUI, nwMinimal):
"""Test loading and saving a document with the NWDoc class. """Test loading and saving a document with the NWDoc class.
@@ -120,6 +120,7 @@ def testCoreDocument_LoadSave(monkeypatch, dummyGUI, nwMinimal):
# END Test testCoreDocument_Load # END Test testCoreDocument_Load
@pytest.mark.core @pytest.mark.core
def testCoreDocument_Methods(monkeypatch, dummyGUI, nwMinimal): def testCoreDocument_Methods(monkeypatch, dummyGUI, nwMinimal):
"""Test other methods of the NWDoc class. """Test other methods of the NWDoc class.
+10 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter NWIndex Class Tester novelWriter NWIndex Class Tester
================================== ==================================
@@ -33,6 +32,7 @@ from nw.core.project import NWProject
from nw.core.index import NWIndex, countWords from nw.core.index import NWIndex, countWords
from nw.enum import nwItemClass, nwItemLayout from nw.enum import nwItemClass, nwItemLayout
@pytest.mark.core @pytest.mark.core
def testCoreIndex_LoadSave(monkeypatch, nwLipsum, dummyGUI, outDir, refDir): def testCoreIndex_LoadSave(monkeypatch, nwLipsum, dummyGUI, outDir, refDir):
"""Test core functionality of scaning, saving, loading and checking """Test core functionality of scaning, saving, loading and checking
@@ -124,6 +124,7 @@ def testCoreIndex_LoadSave(monkeypatch, nwLipsum, dummyGUI, outDir, refDir):
# END Test testCoreIndex_LoadSave # END Test testCoreIndex_LoadSave
@pytest.mark.core @pytest.mark.core
def testCoreIndex_ScanThis(nwMinimal, dummyGUI): def testCoreIndex_ScanThis(nwMinimal, dummyGUI):
"""Test the tag scanner function scanThis. """Test the tag scanner function scanThis.
@@ -175,6 +176,7 @@ def testCoreIndex_ScanThis(nwMinimal, dummyGUI):
# END Test testCoreIndex_ScanThis # END Test testCoreIndex_ScanThis
@pytest.mark.core @pytest.mark.core
def testCoreIndex_CheckThese(nwMinimal, dummyGUI): def testCoreIndex_CheckThese(nwMinimal, dummyGUI):
"""Test the tag checker function checkThese. """Test the tag checker function checkThese.
@@ -236,6 +238,7 @@ def testCoreIndex_CheckThese(nwMinimal, dummyGUI):
# END Test testCoreIndex_CheckThese # END Test testCoreIndex_CheckThese
@pytest.mark.core @pytest.mark.core
def testCoreIndex_ScanText(nwMinimal, dummyGUI): def testCoreIndex_ScanText(nwMinimal, dummyGUI):
"""Check the index text scanner. """Check the index text scanner.
@@ -441,6 +444,7 @@ def testCoreIndex_ScanText(nwMinimal, dummyGUI):
# END Test testCoreIndex_ScanText # END Test testCoreIndex_ScanText
@pytest.mark.core @pytest.mark.core
def testCoreIndex_ExtractData(nwMinimal, dummyGUI): def testCoreIndex_ExtractData(nwMinimal, dummyGUI):
"""Check the index data extraction functions. """Check the index data extraction functions.
@@ -673,6 +677,7 @@ def testCoreIndex_ExtractData(nwMinimal, dummyGUI):
# END Test testCoreIndex_ExtractData # END Test testCoreIndex_ExtractData
@pytest.mark.core @pytest.mark.core
def testCoreIndex_CheckTagIndex(dummyGUI): def testCoreIndex_CheckTagIndex(dummyGUI):
"""Test the tag index checker. """Test the tag index checker.
@@ -737,6 +742,7 @@ def testCoreIndex_CheckTagIndex(dummyGUI):
# END Test testCoreIndex_CheckTagIndex # END Test testCoreIndex_CheckTagIndex
@pytest.mark.core @pytest.mark.core
def testCoreIndex_CheckRefIndex(dummyGUI): def testCoreIndex_CheckRefIndex(dummyGUI):
"""Test the reference index checker. """Test the reference index checker.
@@ -859,6 +865,7 @@ def testCoreIndex_CheckRefIndex(dummyGUI):
# END Test testCoreIndex_CheckRefIndex # END Test testCoreIndex_CheckRefIndex
@pytest.mark.core @pytest.mark.core
def testCoreIndex_CheckNovelNoteIndex(dummyGUI): def testCoreIndex_CheckNovelNoteIndex(dummyGUI):
"""Test the novel and note index checkers. """Test the novel and note index checkers.
@@ -1117,6 +1124,7 @@ def testCoreIndex_CheckNovelNoteIndex(dummyGUI):
# END Test testCoreIndex_CheckNovelNoteIndex # END Test testCoreIndex_CheckNovelNoteIndex
@pytest.mark.core @pytest.mark.core
def testCoreIndex_CheckTextCounts(dummyGUI): def testCoreIndex_CheckTextCounts(dummyGUI):
"""Test the text counts checker. """Test the text counts checker.
@@ -1173,6 +1181,7 @@ def testCoreIndex_CheckTextCounts(dummyGUI):
# END Test testCoreIndex_CheckTextCounts # END Test testCoreIndex_CheckTextCounts
@pytest.mark.core @pytest.mark.core
def testCoreIndex_CountWords(): def testCoreIndex_CountWords():
"""Test the word counter and the exclusion filers. """Test the word counter and the exclusion filers.
+5 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter NWItem Class Tester novelWriter NWItem Class Tester
================================= =================================
@@ -28,6 +27,7 @@ from nw.core import NWProject
from nw.core.item import NWItem from nw.core.item import NWItem
from nw.enum import nwItemClass, nwItemType, nwItemLayout from nw.enum import nwItemClass, nwItemType, nwItemLayout
@pytest.mark.core @pytest.mark.core
def testCoreItem_Setters(dummyGUI): def testCoreItem_Setters(dummyGUI):
"""Test all the simple setters for the NWItem class. """Test all the simple setters for the NWItem class.
@@ -165,6 +165,7 @@ def testCoreItem_Setters(dummyGUI):
# END Test testCoreItem_Setters # END Test testCoreItem_Setters
@pytest.mark.core @pytest.mark.core
def testCoreItem_TypeSetter(dummyGUI): def testCoreItem_TypeSetter(dummyGUI):
"""Test the setter for all the nwItemType values for the NWItem """Test the setter for all the nwItemType values for the NWItem
@@ -193,6 +194,7 @@ def testCoreItem_TypeSetter(dummyGUI):
# END Test testCoreItem_TypeSetter # END Test testCoreItem_TypeSetter
@pytest.mark.core @pytest.mark.core
def testCoreItem_ClassSetter(dummyGUI): def testCoreItem_ClassSetter(dummyGUI):
"""Test the setter for all the nwItemClass values for the NWItem """Test the setter for all the nwItemClass values for the NWItem
@@ -233,6 +235,7 @@ def testCoreItem_ClassSetter(dummyGUI):
# END Test testCoreItem_ClassSetter # END Test testCoreItem_ClassSetter
@pytest.mark.core @pytest.mark.core
def testCoreItem_LayoutSetter(dummyGUI): def testCoreItem_LayoutSetter(dummyGUI):
"""Test the setter for all the nwItemLayout values for the NWItem """Test the setter for all the nwItemLayout values for the NWItem
@@ -269,6 +272,7 @@ def testCoreItem_LayoutSetter(dummyGUI):
# END Test testCoreItem_LayoutSetter # END Test testCoreItem_LayoutSetter
@pytest.mark.core @pytest.mark.core
def testCoreItem_XMLPackUnpack(dummyGUI, caplog): def testCoreItem_XMLPackUnpack(dummyGUI, caplog):
"""Test packing and unpacking XML objects for the NWItem class. """Test packing and unpacking XML objects for the NWItem class.
+2 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter OptionState Class Tester novelWriter OptionState Class Tester
====================================== ======================================
@@ -30,6 +29,7 @@ from nw.core import NWProject
from nw.core.options import OptionState from nw.core.options import OptionState
from nw.constants import nwFiles from nw.constants import nwFiles
@pytest.mark.core @pytest.mark.core
def testCoreOptions_LoadSave(monkeypatch, dummyGUI, tmpDir): def testCoreOptions_LoadSave(monkeypatch, dummyGUI, tmpDir):
"""Test loading and saving from the OptionState class. """Test loading and saving from the OptionState class.
@@ -100,6 +100,7 @@ def testCoreOptions_LoadSave(monkeypatch, dummyGUI, tmpDir):
# END Test testCoreOptions_LoadSave # END Test testCoreOptions_LoadSave
@pytest.mark.core @pytest.mark.core
def testCoreOptions_SetGet(monkeypatch, dummyGUI, tmpDir): def testCoreOptions_SetGet(monkeypatch, dummyGUI, tmpDir):
"""Test setting and getting values from the OptionState class. """Test setting and getting values from the OptionState class.
+17 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter NWProject Class Tester novelWriter NWProject Class Tester
==================================== ====================================
@@ -35,6 +34,7 @@ from nw.enum import nwItemClass, nwItemType, nwItemLayout
from nw.common import formatTimeStamp from nw.common import formatTimeStamp
from nw.constants import nwFiles from nw.constants import nwFiles
@pytest.mark.core @pytest.mark.core
def testCoreProject_NewMinimal(fncDir, outDir, refDir, tmpDir, dummyGUI): def testCoreProject_NewMinimal(fncDir, outDir, refDir, tmpDir, dummyGUI):
"""Create a new project from a project wizard dictionary. With """Create a new project from a project wizard dictionary. With
@@ -83,6 +83,7 @@ def testCoreProject_NewMinimal(fncDir, outDir, refDir, tmpDir, dummyGUI):
# END Test testCoreProject_NewMinimal # END Test testCoreProject_NewMinimal
@pytest.mark.core @pytest.mark.core
def testCoreProject_NewCustomA(fncDir, outDir, refDir, dummyGUI): def testCoreProject_NewCustomA(fncDir, outDir, refDir, dummyGUI):
"""Create a new project from a project wizard dictionary. """Create a new project from a project wizard dictionary.
@@ -124,6 +125,7 @@ def testCoreProject_NewCustomA(fncDir, outDir, refDir, dummyGUI):
# END Test testCoreProject_NewCustomA # END Test testCoreProject_NewCustomA
@pytest.mark.core @pytest.mark.core
def testCoreProject_NewCustomB(fncDir, outDir, refDir, dummyGUI): def testCoreProject_NewCustomB(fncDir, outDir, refDir, dummyGUI):
"""Create a new project from a project wizard dictionary. """Create a new project from a project wizard dictionary.
@@ -165,6 +167,7 @@ def testCoreProject_NewCustomB(fncDir, outDir, refDir, dummyGUI):
# END Test testCoreProject_NewCustomB # END Test testCoreProject_NewCustomB
@pytest.mark.core @pytest.mark.core
def testCoreProject_NewSampleA(fncDir, tmpConf, dummyGUI, tmpDir): def testCoreProject_NewSampleA(fncDir, tmpConf, dummyGUI, tmpDir):
"""Check that we can create a new project can be created from the """Check that we can create a new project can be created from the
@@ -213,6 +216,7 @@ def testCoreProject_NewSampleA(fncDir, tmpConf, dummyGUI, tmpDir):
# END Test testCoreProject_NewSampleA # END Test testCoreProject_NewSampleA
@pytest.mark.core @pytest.mark.core
def testCoreProject_NewSampleB(monkeypatch, fncDir, tmpConf, dummyGUI, tmpDir): def testCoreProject_NewSampleB(monkeypatch, fncDir, tmpConf, dummyGUI, tmpDir):
"""Check that we can create a new project can be created from the """Check that we can create a new project can be created from the
@@ -250,6 +254,7 @@ def testCoreProject_NewSampleB(monkeypatch, fncDir, tmpConf, dummyGUI, tmpDir):
# END Test testCoreProject_NewSampleB # END Test testCoreProject_NewSampleB
@pytest.mark.core @pytest.mark.core
def testCoreProject_NewRoot(fncDir, outDir, refDir, dummyGUI): def testCoreProject_NewRoot(fncDir, outDir, refDir, dummyGUI):
"""Check that new root folders can be added to the project. """Check that new root folders can be added to the project.
@@ -286,6 +291,7 @@ def testCoreProject_NewRoot(fncDir, outDir, refDir, dummyGUI):
# END Test testCoreProject_NewRoot # END Test testCoreProject_NewRoot
@pytest.mark.core @pytest.mark.core
def testCoreProject_NewFile(fncDir, outDir, refDir, dummyGUI): def testCoreProject_NewFile(fncDir, outDir, refDir, dummyGUI):
"""Check that new files can be added to the project. """Check that new files can be added to the project.
@@ -315,6 +321,7 @@ def testCoreProject_NewFile(fncDir, outDir, refDir, dummyGUI):
# END Test testCoreProject_NewFile # END Test testCoreProject_NewFile
@pytest.mark.core @pytest.mark.core
def testCoreProject_Open(monkeypatch, nwMinimal, dummyGUI): def testCoreProject_Open(monkeypatch, nwMinimal, dummyGUI):
"""Test opening a project. """Test opening a project.
@@ -436,6 +443,7 @@ def testCoreProject_Open(monkeypatch, nwMinimal, dummyGUI):
# END Test testCoreProject_Open # END Test testCoreProject_Open
@pytest.mark.core @pytest.mark.core
def testCoreProject_Save(monkeypatch, nwMinimal, dummyGUI, refDir): def testCoreProject_Save(monkeypatch, nwMinimal, dummyGUI, refDir):
"""Test saving a project. """Test saving a project.
@@ -481,6 +489,7 @@ def testCoreProject_Save(monkeypatch, nwMinimal, dummyGUI, refDir):
# END Test testCoreProject_Save # END Test testCoreProject_Save
@pytest.mark.core @pytest.mark.core
def testCoreProject_LockFile(monkeypatch, fncDir, dummyGUI): def testCoreProject_LockFile(monkeypatch, fncDir, dummyGUI):
"""Test lock file functions for the project folder. """Test lock file functions for the project folder.
@@ -540,6 +549,7 @@ def testCoreProject_LockFile(monkeypatch, fncDir, dummyGUI):
# END Test testCoreProject_LockFile # END Test testCoreProject_LockFile
@pytest.mark.core @pytest.mark.core
def testCoreProject_Helpers(monkeypatch, fncDir, dummyGUI): def testCoreProject_Helpers(monkeypatch, fncDir, dummyGUI):
"""Test helper functions for the project folder. """Test helper functions for the project folder.
@@ -583,6 +593,7 @@ def testCoreProject_Helpers(monkeypatch, fncDir, dummyGUI):
# END Test testCoreProject_Helpers # END Test testCoreProject_Helpers
@pytest.mark.core @pytest.mark.core
def testCoreProject_AccessItems(nwMinimal, dummyGUI): def testCoreProject_AccessItems(nwMinimal, dummyGUI):
"""Test helper functions for the project folder. """Test helper functions for the project folder.
@@ -642,6 +653,7 @@ def testCoreProject_AccessItems(nwMinimal, dummyGUI):
# END Test testCoreProject_AccessItems # END Test testCoreProject_AccessItems
@pytest.mark.core @pytest.mark.core
def testCoreProject_Methods(monkeypatch, nwMinimal, dummyGUI, tmpDir): def testCoreProject_Methods(monkeypatch, nwMinimal, dummyGUI, tmpDir):
"""Test other project class methods and functions. """Test other project class methods and functions.
@@ -892,6 +904,7 @@ def testCoreProject_Methods(monkeypatch, nwMinimal, dummyGUI, tmpDir):
# END Test testCoreProject_Methods # END Test testCoreProject_Methods
@pytest.mark.core @pytest.mark.core
def testCoreProject_OrphanedFiles(dummyGUI, nwLipsum): def testCoreProject_OrphanedFiles(dummyGUI, nwLipsum):
"""Check that files in the content folder that are not tracked in """Check that files in the content folder that are not tracked in
@@ -968,6 +981,7 @@ def testCoreProject_OrphanedFiles(dummyGUI, nwLipsum):
# END Test testCoreProject_OrphanedFiles # END Test testCoreProject_OrphanedFiles
@pytest.mark.core @pytest.mark.core
def testCoreProject_OldFormat(dummyGUI, nwOldProj): def testCoreProject_OldFormat(dummyGUI, nwOldProj):
"""Test that a project folder structure of version 1.0 can be """Test that a project folder structure of version 1.0 can be
@@ -1057,6 +1071,7 @@ def testCoreProject_OldFormat(dummyGUI, nwOldProj):
# END Test testCoreProject_OldFormat # END Test testCoreProject_OldFormat
@pytest.mark.core @pytest.mark.core
def testCoreProject_LegacyData(monkeypatch, dummyGUI, fncDir): def testCoreProject_LegacyData(monkeypatch, dummyGUI, fncDir):
"""Test the functins that handle legacy data folders and structure """Test the functins that handle legacy data folders and structure
@@ -1162,6 +1177,7 @@ def testCoreProject_LegacyData(monkeypatch, dummyGUI, fncDir):
# END Test testCoreProject_LegacyData # END Test testCoreProject_LegacyData
@pytest.mark.core @pytest.mark.core
def testCoreProject_Backup(monkeypatch, dummyGUI, nwMinimal, tmpDir): def testCoreProject_Backup(monkeypatch, dummyGUI, nwMinimal, tmpDir):
"""Test the automated backup feature of the project class. The test """Test the automated backup feature of the project class. The test
+3 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Spell Check Classes Tester novelWriter Spell Check Classes Tester
======================================== ========================================
@@ -29,6 +28,7 @@ from tools import readFile, writeFile
from nw.core.spellcheck import NWSpellCheck, NWSpellEnchant, NWSpellSimple from nw.core.spellcheck import NWSpellCheck, NWSpellEnchant, NWSpellSimple
@pytest.mark.core @pytest.mark.core
def testCoreSpell_Super(monkeypatch, tmpDir): def testCoreSpell_Super(monkeypatch, tmpDir):
"""Test the spell checker super class """Test the spell checker super class
@@ -70,6 +70,7 @@ def testCoreSpell_Super(monkeypatch, tmpDir):
# END Test testCoreSpell_Super # END Test testCoreSpell_Super
@pytest.mark.core @pytest.mark.core
def testCoreSpell_Enchant(monkeypatch, tmpDir): def testCoreSpell_Enchant(monkeypatch, tmpDir):
"""Test the pyenchant spell checker """Test the pyenchant spell checker
@@ -114,6 +115,7 @@ def testCoreSpell_Enchant(monkeypatch, tmpDir):
# END Test testCoreSpell_Enchant # END Test testCoreSpell_Enchant
@pytest.mark.core @pytest.mark.core
def testCoreSpell_Simple(monkeypatch, tmpDir): def testCoreSpell_Simple(monkeypatch, tmpDir):
"""Test the fallback simple spell checker """Test the fallback simple spell checker
+2 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter NWStatus Class Tester novelWriter NWStatus Class Tester
=================================== ===================================
@@ -26,6 +25,7 @@ from lxml import etree
from nw.core.status import NWStatus from nw.core.status import NWStatus
@pytest.mark.core @pytest.mark.core
def testCoreStatus_Entries(): def testCoreStatus_Entries():
"""Test all the simple setters for the NWItem class. """Test all the simple setters for the NWItem class.
@@ -100,6 +100,7 @@ def testCoreStatus_Entries():
# END Test testCoreStatus_Entries # END Test testCoreStatus_Entries
@pytest.mark.core @pytest.mark.core
def testCoreStatus_XMLPackUnpack(): def testCoreStatus_XMLPackUnpack():
"""Test all the simple setters for the NWItem class. """Test all the simple setters for the NWItem class.
+5 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter ToHtml Class Tester novelWriter ToHtml Class Tester
================================= =================================
@@ -27,6 +26,7 @@ from tools import readFile
from nw.core import NWProject, NWIndex, ToHtml from nw.core import NWProject, NWIndex, ToHtml
@pytest.mark.core @pytest.mark.core
def testCoreToHtml_Format(dummyGUI): def testCoreToHtml_Format(dummyGUI):
"""Test all the formatters for the ToHtml class. """Test all the formatters for the ToHtml class.
@@ -79,6 +79,7 @@ def testCoreToHtml_Format(dummyGUI):
# END Test testCoreToHtml_Format # END Test testCoreToHtml_Format
@pytest.mark.core @pytest.mark.core
def testCoreToHtml_Convert(dummyGUI): def testCoreToHtml_Convert(dummyGUI):
"""Test the converter of the ToHtml class. """Test the converter of the ToHtml class.
@@ -344,6 +345,8 @@ def testCoreToHtml_Convert(dummyGUI):
# END Test testCoreToHtml_Convert # END Test testCoreToHtml_Convert
@pytest.mark.core
def testCoreToHtml_Complex(dummyGUI, fncDir): def testCoreToHtml_Complex(dummyGUI, fncDir):
"""Test the ave method of the ToHtml class. """Test the ave method of the ToHtml class.
""" """
@@ -416,6 +419,7 @@ def testCoreToHtml_Complex(dummyGUI, fncDir):
# END Test testCoreToHtml_Save # END Test testCoreToHtml_Save
@pytest.mark.core @pytest.mark.core
def testCoreToHtml_Methods(dummyGUI): def testCoreToHtml_Methods(dummyGUI):
"""Test all the other methods of the ToHtml class. """Test all the other methods of the ToHtml class.
+4 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Tokenizer Class Tester novelWriter Tokenizer Class Tester
==================================== ====================================
@@ -28,6 +27,7 @@ from tools import readFile
from nw.core import NWProject, NWDoc from nw.core import NWProject, NWDoc
from nw.core.tokenizer import Tokenizer from nw.core.tokenizer import Tokenizer
@pytest.mark.core @pytest.mark.core
def testCoreToken_Setters(dummyGUI): def testCoreToken_Setters(dummyGUI):
"""Test all the setters for the Tokenizer class. """Test all the setters for the Tokenizer class.
@@ -111,6 +111,7 @@ def testCoreToken_Setters(dummyGUI):
# END Test testCoreToken_Setters # END Test testCoreToken_Setters
@pytest.mark.core @pytest.mark.core
def testCoreToken_TextOps(monkeypatch, nwMinimal, dummyGUI): def testCoreToken_TextOps(monkeypatch, nwMinimal, dummyGUI):
"""Test handling files and text in the Tokenizer class. """Test handling files and text in the Tokenizer class.
@@ -193,6 +194,7 @@ def testCoreToken_TextOps(monkeypatch, nwMinimal, dummyGUI):
# END Test testCoreToken_TextOps # END Test testCoreToken_TextOps
@pytest.mark.core @pytest.mark.core
def testCoreToken_Tokenize(dummyGUI): def testCoreToken_Tokenize(dummyGUI):
"""Test the tokenization of the Tokenizer class. """Test the tokenization of the Tokenizer class.
@@ -494,6 +496,7 @@ def testCoreToken_Tokenize(dummyGUI):
# END Test testCoreToken_Tokenize # END Test testCoreToken_Tokenize
@pytest.mark.core @pytest.mark.core
def testCoreToken_Headers(dummyGUI): def testCoreToken_Headers(dummyGUI):
"""Test the header and page parser of the Tokenizer class. """Test the header and page parser of the Tokenizer class.
+2 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter ToOdt Class Tester novelWriter ToOdt Class Tester
================================= =================================
@@ -35,6 +34,7 @@ XML_NS = [
' xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"', ' xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"',
] ]
def xmlToText(xElem): def xmlToText(xElem):
"""Get the text content of an XML element. """Get the text content of an XML element.
""" """
@@ -43,6 +43,7 @@ def xmlToText(xElem):
rTxt = rTxt.replace(nSpace, "") rTxt = rTxt.replace(nSpace, "")
return rTxt return rTxt
@pytest.mark.core @pytest.mark.core
def testCoreToOdt_Convert(dummyGUI): def testCoreToOdt_Convert(dummyGUI):
"""Test the converter of the ToHtml class. """Test the converter of the ToHtml class.
+9 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter NWTree Class Tester novelWriter NWTree Class Tester
================================= =================================
@@ -30,6 +29,7 @@ from nw.core.project import NWProject, NWItem, NWTree
from nw.enum import nwItemClass, nwItemType, nwItemLayout from nw.enum import nwItemClass, nwItemType, nwItemLayout
from nw.constants import nwFiles from nw.constants import nwFiles
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def dummyItems(dummyGUI): def dummyItems(dummyGUI):
"""Create a list of mock items. """Create a list of mock items.
@@ -106,6 +106,7 @@ def dummyItems(dummyGUI):
return theItems return theItems
@pytest.mark.core @pytest.mark.core
def testCoreTree_BuildTree(dummyGUI, dummyItems): def testCoreTree_BuildTree(dummyGUI, dummyItems):
"""Test building a project tree from a list of items. """Test building a project tree from a list of items.
@@ -202,6 +203,7 @@ def testCoreTree_BuildTree(dummyGUI, dummyItems):
# END Test testCoreTree_BuildTree # END Test testCoreTree_BuildTree
@pytest.mark.core @pytest.mark.core
def testCoreTree_Methods(dummyGUI, dummyItems): def testCoreTree_Methods(dummyGUI, dummyItems):
"""Test bvarious class methods. """Test bvarious class methods.
@@ -258,6 +260,7 @@ def testCoreTree_Methods(dummyGUI, dummyItems):
# END Test testCoreTree_Methods # END Test testCoreTree_Methods
@pytest.mark.core @pytest.mark.core
def testCoreTree_UpdateItemLayout(dummyGUI, dummyItems): def testCoreTree_UpdateItemLayout(dummyGUI, dummyItems):
"""Test building a project tree from a list of items. """Test building a project tree from a list of items.
@@ -383,6 +386,7 @@ def testCoreTree_UpdateItemLayout(dummyGUI, dummyItems):
# END Test testCoreTree_UpdateItemLayout # END Test testCoreTree_UpdateItemLayout
@pytest.mark.core @pytest.mark.core
def testCoreTree_MakeHandles(monkeypatch, dummyGUI): def testCoreTree_MakeHandles(monkeypatch, dummyGUI):
"""Test generating item handles. """Test generating item handles.
@@ -425,6 +429,7 @@ def testCoreTree_MakeHandles(monkeypatch, dummyGUI):
# END Test testCoreTree_MakeHandles # END Test testCoreTree_MakeHandles
@pytest.mark.core @pytest.mark.core
def testCoreTree_Stats(dummyGUI, dummyItems): def testCoreTree_Stats(dummyGUI, dummyItems):
"""Test project stats methods. """Test project stats methods.
@@ -451,6 +456,7 @@ def testCoreTree_Stats(dummyGUI, dummyItems):
# END Test testCoreTree_Stats # END Test testCoreTree_Stats
@pytest.mark.core @pytest.mark.core
def testCoreTree_Reorder(dummyGUI, dummyItems): def testCoreTree_Reorder(dummyGUI, dummyItems):
"""Test changing tree order. """Test changing tree order.
@@ -482,6 +488,7 @@ def testCoreTree_Reorder(dummyGUI, dummyItems):
# END Test testCoreTree_Reorder # END Test testCoreTree_Reorder
@pytest.mark.core @pytest.mark.core
def testCoreTree_XMLPackUnpack(dummyGUI, dummyItems): def testCoreTree_XMLPackUnpack(dummyGUI, dummyItems):
"""Test packing and unpacking the tree to and from XML. """Test packing and unpacking the tree to and from XML.
@@ -537,6 +544,7 @@ def testCoreTree_XMLPackUnpack(dummyGUI, dummyItems):
# END Test testCoreTree_XMLPackUnpack # END Test testCoreTree_XMLPackUnpack
@pytest.mark.core @pytest.mark.core
def testCoreTree_ToCFile(monkeypatch, dummyGUI, dummyItems, tmpDir): def testCoreTree_ToCFile(monkeypatch, dummyGUI, dummyItems, tmpDir):
"""Test writing the ToC.txt file. """Test writing the ToC.txt file.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter About Dialog Class Tester novelWriter About Dialog Class Tester
======================================= =======================================
@@ -32,6 +31,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testDlgAbout_Dialog(qtbot, monkeypatch, nwGUI): def testDlgAbout_Dialog(qtbot, monkeypatch, nwGUI):
"""Test the full about dialogs. """Test the full about dialogs.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Other Dialog Classes Tester novelWriter Other Dialog Classes Tester
========================================= =========================================
@@ -31,6 +30,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testDlgOther_QuoteSelect(qtbot, monkeypatch, nwGUI, nwMinimal): def testDlgOther_QuoteSelect(qtbot, monkeypatch, nwGUI, nwMinimal):
"""Test the quote symbols dialog. """Test the quote symbols dialog.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Item Editor Dialog Class Tester novelWriter Item Editor Dialog Class Tester
============================================= =============================================
@@ -36,6 +35,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testDlgItemEditor_Dialog(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDir): def testDlgItemEditor_Dialog(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDir):
"""Test the full item editor dialog. """Test the full item editor dialog.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Merge and Split Dialog Classes Tester novelWriter Merge and Split Dialog Classes Tester
=================================================== ===================================================
@@ -36,6 +35,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testDlgMerge_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj): def testDlgMerge_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
"""Test the merge documents tool. """Test the merge documents tool.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Preferences Dialog Class Tester novelWriter Preferences Dialog Class Tester
============================================= =============================================
@@ -40,6 +39,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testDlgPreferences_Main(qtbot, monkeypatch, fncDir, outDir, refDir): def testDlgPreferences_Main(qtbot, monkeypatch, fncDir, outDir, refDir):
"""Test the load project wizard. """Test the load project wizard.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Project Load Dialog Class Tester novelWriter Project Load Dialog Class Tester
============================================== ==============================================
@@ -37,6 +36,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testDlgLoadProject_Main(qtbot, monkeypatch, nwGUI, nwMinimal): def testDlgLoadProject_Main(qtbot, monkeypatch, nwGUI, nwMinimal):
"""Test the load project wizard. """Test the load project wizard.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Project Settings Dialog Class Tester novelWriter Project Settings Dialog Class Tester
================================================== ==================================================
@@ -38,6 +37,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testDlgProjSettings_Dialog(qtbot, monkeypatch, nwGUI, fncDir, fncProj, outDir, refDir): def testDlgProjSettings_Dialog(qtbot, monkeypatch, nwGUI, fncDir, fncProj, outDir, refDir):
"""Test the full project settings dialog. """Test the full project settings dialog.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Merge and Split Dialog Classes Tester novelWriter Merge and Split Dialog Classes Tester
=================================================== ===================================================
@@ -37,6 +36,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testDlgSplit_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj): def testDlgSplit_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
"""Test the split document tool. """Test the split document tool.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Other Dialog Classes Tester novelWriter Other Dialog Classes Tester
========================================= =========================================
@@ -35,6 +34,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
def testDlgWordList_Dialog(qtbot, monkeypatch, nwGUI, nwMinimal, tmpDir): def testDlgWordList_Dialog(qtbot, monkeypatch, nwGUI, nwMinimal, tmpDir):
"""test the word list editor. """test the word list editor.
""" """
+2 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Main GUI Editor Class Tester novelWriter Main GUI Editor Class Tester
========================================== ==========================================
@@ -39,6 +38,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir): def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir):
"""Test the document editor. """Test the document editor.
@@ -353,6 +353,7 @@ def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir):
# END Test testGuiEditor_Main # END Test testGuiEditor_Main
@pytest.mark.gui @pytest.mark.gui
def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum): def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum):
"""Test the document editor search functionality. """Test the document editor search functionality.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Main GUI Viewer Class Tester novelWriter Main GUI Viewer Class Tester
========================================== ==========================================
@@ -32,6 +31,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, nwLipsum): def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, nwLipsum):
"""Test the document viewer. """Test the document viewer.
+3 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Main GUI Main Menu Class Tester novelWriter Main GUI Main Menu Class Tester
============================================= =============================================
@@ -35,6 +34,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum): def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
"""Test the main menu Edit and Format entries. """Test the main menu Edit and Format entries.
@@ -368,6 +368,7 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
# END Test testGuiMenu_EditFormat # END Test testGuiMenu_EditFormat
@pytest.mark.gui @pytest.mark.gui
def testGuiMenu_ContextMenus(qtbot, monkeypatch, nwGUI, nwLipsum): def testGuiMenu_ContextMenus(qtbot, monkeypatch, nwGUI, nwLipsum):
"""Test the context menus. """Test the context menus.
@@ -452,6 +453,7 @@ def testGuiMenu_ContextMenus(qtbot, monkeypatch, nwGUI, nwLipsum):
# END Test testGuiMenu_ContextMenus # END Test testGuiMenu_ContextMenus
@pytest.mark.gui @pytest.mark.gui
def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj): def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
"""Test the Insert menu. """Test the Insert menu.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Main GUI Novel Tree Class Tester novelWriter Main GUI Novel Tree Class Tester
============================================== ==============================================
@@ -28,6 +27,7 @@ from tools import writeFile
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMessageBox from PyQt5.QtWidgets import QMessageBox
@pytest.mark.gui @pytest.mark.gui
def testGuiNovelTree_TreeItems(qtbot, caplog, monkeypatch, nwGUI, nwMinimal): def testGuiNovelTree_TreeItems(qtbot, caplog, monkeypatch, nwGUI, nwMinimal):
"""Test navigating the novel tree. """Test navigating the novel tree.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Main GUI Outline Class Tester novelWriter Main GUI Outline Class Tester
=========================================== ===========================================
@@ -31,6 +30,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testGuiOutline_Main(qtbot, monkeypatch, nwGUI, nwLipsum): def testGuiOutline_Main(qtbot, monkeypatch, nwGUI, nwLipsum):
"""Test the outline view. """Test the outline view.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Project Details Dialog Class Tester novelWriter Project Details Dialog Class Tester
================================================= =================================================
@@ -32,6 +31,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testGuiProjDetails_Dialog(qtbot, monkeypatch, nwGUI, nwLipsum): def testGuiProjDetails_Dialog(qtbot, monkeypatch, nwGUI, nwLipsum):
"""Test the project details dialog. """Test the project details dialog.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Main GUI Project Tree Class Tester novelWriter Main GUI Project Tree Class Tester
================================================ ================================================
@@ -32,6 +31,7 @@ from nw.guimain import GuiMain
from nw.gui.projtree import GuiProjectTree from nw.gui.projtree import GuiProjectTree
from nw.enum import nwItemType, nwItemClass from nw.enum import nwItemType, nwItemClass
@pytest.mark.gui @pytest.mark.gui
def testGuiProjTree_TreeItems(qtbot, caplog, monkeypatch, nwGUI, nwMinimal): def testGuiProjTree_TreeItems(qtbot, caplog, monkeypatch, nwGUI, nwMinimal):
"""Test adding and removing items from the project tree. """Test adding and removing items from the project tree.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter GUI Theme and Icons Classes Tester novelWriter GUI Theme and Icons Classes Tester
================================================ ================================================
@@ -30,6 +29,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testGuiTheme_Main(qtbot, monkeypatch, nwMinimal, tmpDir): def testGuiTheme_Main(qtbot, monkeypatch, nwMinimal, tmpDir):
"""Test the theme and icon classes. """Test the theme and icon classes.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Build Dialog Class Tester novelWriter Build Dialog Class Tester
======================================= =======================================
@@ -35,6 +34,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testToolBuild_Main(qtbot, monkeypatch, nwGUI, nwLipsum, refDir, outDir): def testToolBuild_Main(qtbot, monkeypatch, nwGUI, nwLipsum, refDir, outDir):
"""Test the build tool. """Test the build tool.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter New Project Wizard Class Tester novelWriter New Project Wizard Class Tester
============================================= =============================================
@@ -39,6 +38,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testToolProjectWizard_Main(qtbot, monkeypatch, nwGUI, nwMinimal): def testToolProjectWizard_Main(qtbot, monkeypatch, nwGUI, nwMinimal):
"""Test the new project wizard. """Test the new project wizard.
+1 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Writing Stats Dialog Class Tester novelWriter Writing Stats Dialog Class Tester
=============================================== ===============================================
@@ -37,6 +36,7 @@ keyDelay = 2
typeDelay = 1 typeDelay = 1
stepDelay = 20 stepDelay = 20
@pytest.mark.gui @pytest.mark.gui
def testToolWritingStats_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj): def testToolWritingStats_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
"""Test the full writing stats tool. """Test the full writing stats tool.
+5 -1
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
novelWriter Test Suite Tools novelWriter Test Suite Tools
============================== ==============================
@@ -25,6 +24,7 @@ import shutil
from PyQt5.QtWidgets import qApp from PyQt5.QtWidgets import qApp
def cmpFiles(fileOne, fileTwo, ignoreLines=None): def cmpFiles(fileOne, fileTwo, ignoreLines=None):
"""Compare two files, but optionally ignore lines given by a list. """Compare two files, but optionally ignore lines given by a list.
""" """
@@ -70,6 +70,7 @@ def cmpFiles(fileOne, fileTwo, ignoreLines=None):
return not diffFound return not diffFound
def getGuiItem(theName): def getGuiItem(theName):
"""Returns a QtWidget based on its objectName. """Returns a QtWidget based on its objectName.
""" """
@@ -78,18 +79,21 @@ def getGuiItem(theName):
return qWidget return qWidget
return None return None
def readFile(fileName): def readFile(fileName):
"""Returns the content of a file as a string. """Returns the content of a file as a string.
""" """
with open(fileName, mode="r", encoding="utf8") as inFile: with open(fileName, mode="r", encoding="utf8") as inFile:
return inFile.read() return inFile.read()
def writeFile(fileName, fileData): def writeFile(fileName, fileData):
"""Write the contents of a string to a file. """Write the contents of a string to a file.
""" """
with open(fileName, mode="w", encoding="utf8") as outFile: with open(fileName, mode="w", encoding="utf8") as outFile:
outFile.write(fileData) outFile.write(fileData)
def cleanProject(projPath): def cleanProject(projPath):
"""Delete all generated files in a project. """Delete all generated files in a project.
""" """