diff --git a/docs/source/conf.py b/docs/source/conf.py index 477affed..059176af 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # diff --git a/i18n/qtbase.py b/i18n/qtbase.py index 5b466fc8..795e70d3 100644 --- a/i18n/qtbase.py +++ b/i18n/qtbase.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Qt Base Translation File ======================== diff --git a/setup.py b/setup.py index 4bb3801f..aa24164e 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ novelWriter – Main Setup Script =============================== @@ -35,6 +34,7 @@ OS_LINUX = 1 OS_WIN = 2 OS_DARWIN = 3 + # =============================================================================================== # # Utilities # =============================================================================================== # @@ -66,6 +66,7 @@ def extractVersion(): return numVers, hexVers + # =============================================================================================== # # General # =============================================================================================== # @@ -102,6 +103,7 @@ def installPackages(hostOS): return + ## # Clean Build and Dist Folders (clean) ## @@ -140,6 +142,7 @@ def cleanInstall(): return + # =============================================================================================== # # Additional Buiilds # =============================================================================================== # @@ -217,6 +220,7 @@ def buildQtDocs(): return + ## # Qt Linguist QM Builder (qtlrelease) ## @@ -255,6 +259,7 @@ def buildQtI18n(): return + ## # Qt Linguist TS Builder (qtlupdate) ## @@ -278,6 +283,7 @@ def buildQtI18nTS(): return + ## # Sample Project ZIP File Builder (sample) ## @@ -318,6 +324,7 @@ def buildSampleZip(): return + # =============================================================================================== # # Python Packaging # =============================================================================================== # @@ -429,6 +436,7 @@ def makeMinimalPackage(targetOS): return + ## # Make Simple Package (pack-pyz) ## @@ -607,6 +615,7 @@ def makeSimplePackage(embedPython): return + # =============================================================================================== # # General Installers # =============================================================================================== # @@ -754,6 +763,7 @@ def xdgInstall(): return + ## # XDG Uninstallation (xdg-uninstall) ## @@ -823,6 +833,7 @@ def xdgUninstall(): return + ## # WIN Installation (win-install) ## @@ -947,6 +958,7 @@ def winInstall(): return + ## # WIN Uninstallation (win-uninstall) ## @@ -1033,6 +1045,7 @@ def winUninstall(): return + # =============================================================================================== # # Windows Installers # =============================================================================================== # @@ -1070,6 +1083,7 @@ def innoSetup(): return + # =============================================================================================== # # Process Command Line # =============================================================================================== # diff --git a/tests/conftest.py b/tests/conftest.py index 7459f21a..c1ae3f47 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Test Suite Configuration ====================================== @@ -34,6 +33,7 @@ import nw # noqa: E402 from nw.config import Config # noqa: E402 + ## # Core Test Folders ## @@ -52,6 +52,7 @@ def tmpDir(): os.mkdir(theDir) return theDir + @pytest.fixture(scope="session") def refDir(): """The folder where all the reference files are stored for verifying @@ -61,6 +62,7 @@ def refDir(): theDir = os.path.join(testDir, "reference") return theDir + @pytest.fixture(scope="session") def filesDir(): """The folder where additional test files are stored. @@ -69,6 +71,7 @@ def filesDir(): theDir = os.path.join(testDir, "files") return theDir + @pytest.fixture(scope="session") def outDir(tmpDir): """An output folder for test results @@ -78,6 +81,7 @@ def outDir(tmpDir): os.mkdir(theDir) return theDir + @pytest.fixture(scope="function") def fncDir(tmpDir): """A temporary folder for a single test function. @@ -92,6 +96,7 @@ def fncDir(tmpDir): shutil.rmtree(fncDir) return + @pytest.fixture(scope="function") def fncProj(fncDir): """A temporary folder for a single test function, @@ -104,6 +109,7 @@ def fncProj(fncDir): os.mkdir(prjDir) return prjDir + ## # novelWriter Objects ## @@ -121,6 +127,7 @@ def tmpConf(tmpDir): theConf.guiLang = "en_GB" return theConf + @pytest.fixture(scope="function") def fncConf(fncDir): """Create a temporary novelWriter configuration object. @@ -134,6 +141,7 @@ def fncConf(fncDir): theConf.guiLang = "en_GB" return theConf + @pytest.fixture(scope="function") def dummyGUI(monkeypatch, tmpConf): """Create a mock instance of novelWriter's main GUI class. @@ -143,6 +151,7 @@ def dummyGUI(monkeypatch, tmpConf): theGui.mainConf = tmpConf return theGui + @pytest.fixture(scope="function") def nwGUI(qtbot, monkeypatch, fncDir, fncConf): """Create an instance of the novelWriter GUI. @@ -164,6 +173,7 @@ def nwGUI(qtbot, monkeypatch, fncDir, fncConf): return + ## # Temp Project Folders ## @@ -188,6 +198,7 @@ def nwMinimal(tmpDir): return + @pytest.fixture(scope="function") def nwLipsum(tmpDir): """A medium sized novelWriter example project with a lot of Lorem @@ -209,6 +220,7 @@ def nwLipsum(tmpDir): return + @pytest.fixture(scope="function") def nwOldProj(tmpDir): """A minimal movelWriter project using the old folder structure used diff --git a/tests/mock.py b/tests/mock.py index eb76e5a6..c87a95ad 100644 --- a/tests/mock.py +++ b/tests/mock.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ 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 . """ + # =========================================================================== # # Mock GUI # =========================================================================== # @@ -79,6 +79,7 @@ class MockGuiMain(): # END Class MockGuiMain + class MockStatusBar(): def __init__(self): @@ -92,6 +93,7 @@ class MockStatusBar(): # END Class MockStatusBar + class MockApp: def __init__(self): @@ -102,6 +104,7 @@ class MockApp: # END Class MockApp + # =========================================================================== # # Error Functions # Mock functions that will raise errors instead. @@ -110,5 +113,6 @@ class MockApp: def causeOSError(*args, **kwargs): raise OSError("OSError") + def causeException(*args, **kwargs): raise Exception("Exception") diff --git a/tests/test_base/test_base_common.py b/tests/test_base/test_base_common.py index a5698685..e5fb98ce 100644 --- a/tests/test_base/test_base_common.py +++ b/tests/test_base/test_base_common.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Common Functions Tester ===================================== @@ -30,6 +29,7 @@ from nw.common import ( isItemLayout, numberToRoman ) + @pytest.mark.base def testBaseCommon_CheckString(): """Test the checkString function. @@ -44,6 +44,7 @@ def testBaseCommon_CheckString(): # END Test testBaseCommon_CheckString + @pytest.mark.base def testBaseCommon_CheckInt(): """Test the checkInt function. @@ -57,6 +58,7 @@ def testBaseCommon_CheckInt(): # END Test testBaseCommon_CheckInt + @pytest.mark.base def testBaseCommon_CheckBool(): """Test the checkBool function. @@ -75,6 +77,7 @@ def testBaseCommon_CheckBool(): # END Test testBaseCommon_CheckBool + @pytest.mark.base def testBaseCommon_CheckHandle(): """Test the checkHandle function. @@ -88,6 +91,7 @@ def testBaseCommon_CheckHandle(): # END Test testBaseCommon_CheckHandle + @pytest.mark.base def testBaseCommon_IsHandle(): """Test the isHandle function. @@ -102,6 +106,7 @@ def testBaseCommon_IsHandle(): # END Test testBaseCommon_IsHandle + @pytest.mark.base def testBaseCommon_IsTitleTag(): """Test the isItemClass function. @@ -119,6 +124,7 @@ def testBaseCommon_IsTitleTag(): # END Test testBaseCommon_IsTitleTag + @pytest.mark.base def testBaseCommon_IsItemClass(): """Test the isItemClass function. @@ -141,6 +147,7 @@ def testBaseCommon_IsItemClass(): # END Test testBaseCommon_IsItemClass + @pytest.mark.base def testBaseCommon_IsItemType(): """Test the isItemType function. @@ -157,6 +164,7 @@ def testBaseCommon_IsItemType(): # END Test testBaseCommon_IsItemType + @pytest.mark.base def testBaseCommon_IsItemLayout(): """Test the isItemLayout function. @@ -177,6 +185,7 @@ def testBaseCommon_IsItemLayout(): # END Test testBaseCommon_IsItemLayout + @pytest.mark.base def testBaseCommon_HexToInt(): """Test the hexToInt function. @@ -190,6 +199,7 @@ def testBaseCommon_HexToInt(): # END Test testBaseCommon_HexToInt + @pytest.mark.base def testBaseCommon_FormatTimeStamp(): """Test the formatTimeStamp function. @@ -200,6 +210,7 @@ def testBaseCommon_FormatTimeStamp(): # END Test testBaseCommon_FormatTimeStamp + @pytest.mark.base def testBaseCommon_FormatTime(): """Test the formatTime function. @@ -222,6 +233,7 @@ def testBaseCommon_FormatTime(): # END Test testBaseCommon_FormatTime + @pytest.mark.base def testBaseCommon_FormatInt(): """Test the formatInt function. @@ -237,6 +249,7 @@ def testBaseCommon_FormatInt(): # END Test testBaseCommon_FormatInt + @pytest.mark.base def testBaseCommon_TransferCase(): """Test the transferCase function. @@ -251,6 +264,7 @@ def testBaseCommon_TransferCase(): # END Test testBaseCommon_TransferCase + @pytest.mark.base def testBaseCommon_FuzzyTime(): """Test the fuzzyTime function. @@ -286,6 +300,7 @@ def testBaseCommon_FuzzyTime(): # END Test testBaseCommon_FuzzyTime + @pytest.mark.base def testBaseCommon_MakeFileNameSafe(): """Test the fuzzyTime function. @@ -297,6 +312,7 @@ def testBaseCommon_MakeFileNameSafe(): # END Test testBaseCommon_MakeFileNameSafe + @pytest.mark.core def testBaseCommon_RomanNumbers(): """Test conversion of integers to Roman numbers. diff --git a/tests/test_base/test_base_config.py b/tests/test_base/test_base_config.py index aaedc4af..0fcbf876 100644 --- a/tests/test_base/test_base_config.py +++ b/tests/test_base/test_base_config.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Config Class Tester ================================= @@ -33,6 +32,7 @@ from tools import cmpFiles, writeFile from nw.config import Config from nw.constants import nwConst, nwFiles + @pytest.mark.base def testBaseConfig_Constructor(monkeypatch): """Test config contructor. @@ -79,6 +79,7 @@ def testBaseConfig_Constructor(monkeypatch): # END Test testBaseConfig_Constructor + @pytest.mark.base def testBaseConfig_Init(monkeypatch, tmpDir, fncDir, outDir, refDir, filesDir): """Test config intialisation. @@ -205,6 +206,7 @@ def testBaseConfig_Init(monkeypatch, tmpDir, fncDir, outDir, refDir, filesDir): # END Test testBaseConfig_Init + @pytest.mark.base def testBaseConfig_RecentCache(monkeypatch, tmpConf, tmpDir, fncDir): """Test recent cache file. @@ -266,6 +268,7 @@ def testBaseConfig_RecentCache(monkeypatch, tmpConf, tmpDir, fncDir): # END Test testBaseConfig_RecentCache + @pytest.mark.base def testBaseConfig_SetPath(tmpConf, tmpDir): """Test path setters. @@ -297,6 +300,7 @@ def testBaseConfig_SetPath(tmpConf, tmpDir): # END Test testBaseConfig_SetPath + @pytest.mark.base def testBaseConfig_SettersGetters(tmpConf, tmpDir, outDir, refDir): """Set various sizes and positions @@ -470,6 +474,7 @@ def testBaseConfig_SettersGetters(tmpConf, tmpDir, outDir, refDir): # END Test testBaseConfig_SettersGetters + @pytest.mark.base def testBaseConfig_Internal(monkeypatch, tmpConf): """Check internal functions. diff --git a/tests/test_base/test_base_error.py b/tests/test_base/test_base_error.py index 29bec978..6d976568 100644 --- a/tests/test_base/test_base_error.py +++ b/tests/test_base/test_base_error.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Error Handler Tester ================================== @@ -29,6 +28,7 @@ from mock import causeException from nw.error import NWErrorMessage, exceptionHandler + @pytest.mark.base def testBaseError_Dialog(qtbot, monkeypatch, fncDir, tmpDir): """Test the error dialog. @@ -71,6 +71,7 @@ def testBaseError_Dialog(qtbot, monkeypatch, fncDir, tmpDir): # END Test testBaseError_Dialog + @pytest.mark.base def testBaseError_Handler(qtbot, monkeypatch, fncDir, tmpDir): """Test the error handler. This test doesn'thave any asserts, but it diff --git a/tests/test_base/test_base_init.py b/tests/test_base/test_base_init.py index 2bcf9a61..72062bbf 100644 --- a/tests/test_base/test_base_init.py +++ b/tests/test_base/test_base_init.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Main Init Tester ============================== @@ -27,6 +26,7 @@ import sys from mock import MockGuiMain + @pytest.mark.base def testBaseInit_Launch(caplog, monkeypatch, tmpDir): """Check launching the main GUI. @@ -64,6 +64,7 @@ def testBaseInit_Launch(caplog, monkeypatch, tmpDir): # END Test testBaseInit_Launch + @pytest.mark.base def testBaseInit_Options(monkeypatch, tmpDir): """Test command line options for logging level. @@ -136,6 +137,7 @@ def testBaseInit_Options(monkeypatch, tmpDir): # END Test testBaseInit_Options + @pytest.mark.base def testBaseInit_Imports(caplog, monkeypatch, tmpDir): """Check import error handling. diff --git a/tests/test_core/test_core_document.py b/tests/test_core/test_core_document.py index 42df9d1c..a5ead206 100644 --- a/tests/test_core/test_core_document.py +++ b/tests/test_core/test_core_document.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – NWDoc Class Tester ================================ @@ -28,6 +27,7 @@ from mock import causeOSError from nw.core import NWProject, NWDoc from nw.enum import nwItemClass, nwItemLayout + @pytest.mark.core def testCoreDocument_LoadSave(monkeypatch, dummyGUI, nwMinimal): """Test loading and saving a document with the NWDoc class. @@ -120,6 +120,7 @@ def testCoreDocument_LoadSave(monkeypatch, dummyGUI, nwMinimal): # END Test testCoreDocument_Load + @pytest.mark.core def testCoreDocument_Methods(monkeypatch, dummyGUI, nwMinimal): """Test other methods of the NWDoc class. diff --git a/tests/test_core/test_core_index.py b/tests/test_core/test_core_index.py index 0fdde671..888882e3 100644 --- a/tests/test_core/test_core_index.py +++ b/tests/test_core/test_core_index.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – NWIndex Class Tester ================================== @@ -33,6 +32,7 @@ from nw.core.project import NWProject from nw.core.index import NWIndex, countWords from nw.enum import nwItemClass, nwItemLayout + @pytest.mark.core def testCoreIndex_LoadSave(monkeypatch, nwLipsum, dummyGUI, outDir, refDir): """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 + @pytest.mark.core def testCoreIndex_ScanThis(nwMinimal, dummyGUI): """Test the tag scanner function scanThis. @@ -175,6 +176,7 @@ def testCoreIndex_ScanThis(nwMinimal, dummyGUI): # END Test testCoreIndex_ScanThis + @pytest.mark.core def testCoreIndex_CheckThese(nwMinimal, dummyGUI): """Test the tag checker function checkThese. @@ -236,6 +238,7 @@ def testCoreIndex_CheckThese(nwMinimal, dummyGUI): # END Test testCoreIndex_CheckThese + @pytest.mark.core def testCoreIndex_ScanText(nwMinimal, dummyGUI): """Check the index text scanner. @@ -441,6 +444,7 @@ def testCoreIndex_ScanText(nwMinimal, dummyGUI): # END Test testCoreIndex_ScanText + @pytest.mark.core def testCoreIndex_ExtractData(nwMinimal, dummyGUI): """Check the index data extraction functions. @@ -673,6 +677,7 @@ def testCoreIndex_ExtractData(nwMinimal, dummyGUI): # END Test testCoreIndex_ExtractData + @pytest.mark.core def testCoreIndex_CheckTagIndex(dummyGUI): """Test the tag index checker. @@ -737,6 +742,7 @@ def testCoreIndex_CheckTagIndex(dummyGUI): # END Test testCoreIndex_CheckTagIndex + @pytest.mark.core def testCoreIndex_CheckRefIndex(dummyGUI): """Test the reference index checker. @@ -859,6 +865,7 @@ def testCoreIndex_CheckRefIndex(dummyGUI): # END Test testCoreIndex_CheckRefIndex + @pytest.mark.core def testCoreIndex_CheckNovelNoteIndex(dummyGUI): """Test the novel and note index checkers. @@ -1117,6 +1124,7 @@ def testCoreIndex_CheckNovelNoteIndex(dummyGUI): # END Test testCoreIndex_CheckNovelNoteIndex + @pytest.mark.core def testCoreIndex_CheckTextCounts(dummyGUI): """Test the text counts checker. @@ -1173,6 +1181,7 @@ def testCoreIndex_CheckTextCounts(dummyGUI): # END Test testCoreIndex_CheckTextCounts + @pytest.mark.core def testCoreIndex_CountWords(): """Test the word counter and the exclusion filers. diff --git a/tests/test_core/test_core_item.py b/tests/test_core/test_core_item.py index c93140fe..91f0986c 100644 --- a/tests/test_core/test_core_item.py +++ b/tests/test_core/test_core_item.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – NWItem Class Tester ================================= @@ -28,6 +27,7 @@ from nw.core import NWProject from nw.core.item import NWItem from nw.enum import nwItemClass, nwItemType, nwItemLayout + @pytest.mark.core def testCoreItem_Setters(dummyGUI): """Test all the simple setters for the NWItem class. @@ -165,6 +165,7 @@ def testCoreItem_Setters(dummyGUI): # END Test testCoreItem_Setters + @pytest.mark.core def testCoreItem_TypeSetter(dummyGUI): """Test the setter for all the nwItemType values for the NWItem @@ -193,6 +194,7 @@ def testCoreItem_TypeSetter(dummyGUI): # END Test testCoreItem_TypeSetter + @pytest.mark.core def testCoreItem_ClassSetter(dummyGUI): """Test the setter for all the nwItemClass values for the NWItem @@ -233,6 +235,7 @@ def testCoreItem_ClassSetter(dummyGUI): # END Test testCoreItem_ClassSetter + @pytest.mark.core def testCoreItem_LayoutSetter(dummyGUI): """Test the setter for all the nwItemLayout values for the NWItem @@ -269,6 +272,7 @@ def testCoreItem_LayoutSetter(dummyGUI): # END Test testCoreItem_LayoutSetter + @pytest.mark.core def testCoreItem_XMLPackUnpack(dummyGUI, caplog): """Test packing and unpacking XML objects for the NWItem class. diff --git a/tests/test_core/test_core_options.py b/tests/test_core/test_core_options.py index c1ef5209..823ce937 100644 --- a/tests/test_core/test_core_options.py +++ b/tests/test_core/test_core_options.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – OptionState Class Tester ====================================== @@ -30,6 +29,7 @@ from nw.core import NWProject from nw.core.options import OptionState from nw.constants import nwFiles + @pytest.mark.core def testCoreOptions_LoadSave(monkeypatch, dummyGUI, tmpDir): """Test loading and saving from the OptionState class. @@ -100,6 +100,7 @@ def testCoreOptions_LoadSave(monkeypatch, dummyGUI, tmpDir): # END Test testCoreOptions_LoadSave + @pytest.mark.core def testCoreOptions_SetGet(monkeypatch, dummyGUI, tmpDir): """Test setting and getting values from the OptionState class. diff --git a/tests/test_core/test_core_project.py b/tests/test_core/test_core_project.py index 2f016b38..afbcac95 100644 --- a/tests/test_core/test_core_project.py +++ b/tests/test_core/test_core_project.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – NWProject Class Tester ==================================== @@ -35,6 +34,7 @@ from nw.enum import nwItemClass, nwItemType, nwItemLayout from nw.common import formatTimeStamp from nw.constants import nwFiles + @pytest.mark.core def testCoreProject_NewMinimal(fncDir, outDir, refDir, tmpDir, dummyGUI): """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 + @pytest.mark.core def testCoreProject_NewCustomA(fncDir, outDir, refDir, dummyGUI): """Create a new project from a project wizard dictionary. @@ -124,6 +125,7 @@ def testCoreProject_NewCustomA(fncDir, outDir, refDir, dummyGUI): # END Test testCoreProject_NewCustomA + @pytest.mark.core def testCoreProject_NewCustomB(fncDir, outDir, refDir, dummyGUI): """Create a new project from a project wizard dictionary. @@ -165,6 +167,7 @@ def testCoreProject_NewCustomB(fncDir, outDir, refDir, dummyGUI): # END Test testCoreProject_NewCustomB + @pytest.mark.core def testCoreProject_NewSampleA(fncDir, tmpConf, dummyGUI, tmpDir): """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 + @pytest.mark.core def testCoreProject_NewSampleB(monkeypatch, fncDir, tmpConf, dummyGUI, tmpDir): """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 + @pytest.mark.core def testCoreProject_NewRoot(fncDir, outDir, refDir, dummyGUI): """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 + @pytest.mark.core def testCoreProject_NewFile(fncDir, outDir, refDir, dummyGUI): """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 + @pytest.mark.core def testCoreProject_Open(monkeypatch, nwMinimal, dummyGUI): """Test opening a project. @@ -436,6 +443,7 @@ def testCoreProject_Open(monkeypatch, nwMinimal, dummyGUI): # END Test testCoreProject_Open + @pytest.mark.core def testCoreProject_Save(monkeypatch, nwMinimal, dummyGUI, refDir): """Test saving a project. @@ -481,6 +489,7 @@ def testCoreProject_Save(monkeypatch, nwMinimal, dummyGUI, refDir): # END Test testCoreProject_Save + @pytest.mark.core def testCoreProject_LockFile(monkeypatch, fncDir, dummyGUI): """Test lock file functions for the project folder. @@ -540,6 +549,7 @@ def testCoreProject_LockFile(monkeypatch, fncDir, dummyGUI): # END Test testCoreProject_LockFile + @pytest.mark.core def testCoreProject_Helpers(monkeypatch, fncDir, dummyGUI): """Test helper functions for the project folder. @@ -583,6 +593,7 @@ def testCoreProject_Helpers(monkeypatch, fncDir, dummyGUI): # END Test testCoreProject_Helpers + @pytest.mark.core def testCoreProject_AccessItems(nwMinimal, dummyGUI): """Test helper functions for the project folder. @@ -642,6 +653,7 @@ def testCoreProject_AccessItems(nwMinimal, dummyGUI): # END Test testCoreProject_AccessItems + @pytest.mark.core def testCoreProject_Methods(monkeypatch, nwMinimal, dummyGUI, tmpDir): """Test other project class methods and functions. @@ -892,6 +904,7 @@ def testCoreProject_Methods(monkeypatch, nwMinimal, dummyGUI, tmpDir): # END Test testCoreProject_Methods + @pytest.mark.core def testCoreProject_OrphanedFiles(dummyGUI, nwLipsum): """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 + @pytest.mark.core def testCoreProject_OldFormat(dummyGUI, nwOldProj): """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 + @pytest.mark.core def testCoreProject_LegacyData(monkeypatch, dummyGUI, fncDir): """Test the functins that handle legacy data folders and structure @@ -1162,6 +1177,7 @@ def testCoreProject_LegacyData(monkeypatch, dummyGUI, fncDir): # END Test testCoreProject_LegacyData + @pytest.mark.core def testCoreProject_Backup(monkeypatch, dummyGUI, nwMinimal, tmpDir): """Test the automated backup feature of the project class. The test diff --git a/tests/test_core/test_core_spell.py b/tests/test_core/test_core_spell.py index 4c3f3527..ec6ab23e 100644 --- a/tests/test_core/test_core_spell.py +++ b/tests/test_core/test_core_spell.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Spell Check Classes Tester ======================================== @@ -29,6 +28,7 @@ from tools import readFile, writeFile from nw.core.spellcheck import NWSpellCheck, NWSpellEnchant, NWSpellSimple + @pytest.mark.core def testCoreSpell_Super(monkeypatch, tmpDir): """Test the spell checker super class @@ -70,6 +70,7 @@ def testCoreSpell_Super(monkeypatch, tmpDir): # END Test testCoreSpell_Super + @pytest.mark.core def testCoreSpell_Enchant(monkeypatch, tmpDir): """Test the pyenchant spell checker @@ -114,6 +115,7 @@ def testCoreSpell_Enchant(monkeypatch, tmpDir): # END Test testCoreSpell_Enchant + @pytest.mark.core def testCoreSpell_Simple(monkeypatch, tmpDir): """Test the fallback simple spell checker diff --git a/tests/test_core/test_core_status.py b/tests/test_core/test_core_status.py index d3cd7f86..8d145f10 100644 --- a/tests/test_core/test_core_status.py +++ b/tests/test_core/test_core_status.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – NWStatus Class Tester =================================== @@ -26,6 +25,7 @@ from lxml import etree from nw.core.status import NWStatus + @pytest.mark.core def testCoreStatus_Entries(): """Test all the simple setters for the NWItem class. @@ -100,6 +100,7 @@ def testCoreStatus_Entries(): # END Test testCoreStatus_Entries + @pytest.mark.core def testCoreStatus_XMLPackUnpack(): """Test all the simple setters for the NWItem class. diff --git a/tests/test_core/test_core_tohtml.py b/tests/test_core/test_core_tohtml.py index 8706c0c9..947ed3f0 100644 --- a/tests/test_core/test_core_tohtml.py +++ b/tests/test_core/test_core_tohtml.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – ToHtml Class Tester ================================= @@ -27,6 +26,7 @@ from tools import readFile from nw.core import NWProject, NWIndex, ToHtml + @pytest.mark.core def testCoreToHtml_Format(dummyGUI): """Test all the formatters for the ToHtml class. @@ -79,6 +79,7 @@ def testCoreToHtml_Format(dummyGUI): # END Test testCoreToHtml_Format + @pytest.mark.core def testCoreToHtml_Convert(dummyGUI): """Test the converter of the ToHtml class. @@ -344,6 +345,8 @@ def testCoreToHtml_Convert(dummyGUI): # END Test testCoreToHtml_Convert + +@pytest.mark.core def testCoreToHtml_Complex(dummyGUI, fncDir): """Test the ave method of the ToHtml class. """ @@ -416,6 +419,7 @@ def testCoreToHtml_Complex(dummyGUI, fncDir): # END Test testCoreToHtml_Save + @pytest.mark.core def testCoreToHtml_Methods(dummyGUI): """Test all the other methods of the ToHtml class. diff --git a/tests/test_core/test_core_tokenizer.py b/tests/test_core/test_core_tokenizer.py index 79a18b79..5202edb2 100644 --- a/tests/test_core/test_core_tokenizer.py +++ b/tests/test_core/test_core_tokenizer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Tokenizer Class Tester ==================================== @@ -28,6 +27,7 @@ from tools import readFile from nw.core import NWProject, NWDoc from nw.core.tokenizer import Tokenizer + @pytest.mark.core def testCoreToken_Setters(dummyGUI): """Test all the setters for the Tokenizer class. @@ -111,6 +111,7 @@ def testCoreToken_Setters(dummyGUI): # END Test testCoreToken_Setters + @pytest.mark.core def testCoreToken_TextOps(monkeypatch, nwMinimal, dummyGUI): """Test handling files and text in the Tokenizer class. @@ -193,6 +194,7 @@ def testCoreToken_TextOps(monkeypatch, nwMinimal, dummyGUI): # END Test testCoreToken_TextOps + @pytest.mark.core def testCoreToken_Tokenize(dummyGUI): """Test the tokenization of the Tokenizer class. @@ -494,6 +496,7 @@ def testCoreToken_Tokenize(dummyGUI): # END Test testCoreToken_Tokenize + @pytest.mark.core def testCoreToken_Headers(dummyGUI): """Test the header and page parser of the Tokenizer class. diff --git a/tests/test_core/test_core_toodt.py b/tests/test_core/test_core_toodt.py index 4aacf491..0221c8b4 100644 --- a/tests/test_core/test_core_toodt.py +++ b/tests/test_core/test_core_toodt.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – ToOdt Class Tester ================================= @@ -35,6 +34,7 @@ XML_NS = [ ' xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"', ] + def xmlToText(xElem): """Get the text content of an XML element. """ @@ -43,6 +43,7 @@ def xmlToText(xElem): rTxt = rTxt.replace(nSpace, "") return rTxt + @pytest.mark.core def testCoreToOdt_Convert(dummyGUI): """Test the converter of the ToHtml class. diff --git a/tests/test_core/test_core_tree.py b/tests/test_core/test_core_tree.py index 28a886d8..443525a6 100644 --- a/tests/test_core/test_core_tree.py +++ b/tests/test_core/test_core_tree.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ 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.constants import nwFiles + @pytest.fixture(scope="function") def dummyItems(dummyGUI): """Create a list of mock items. @@ -106,6 +106,7 @@ def dummyItems(dummyGUI): return theItems + @pytest.mark.core def testCoreTree_BuildTree(dummyGUI, dummyItems): """Test building a project tree from a list of items. @@ -202,6 +203,7 @@ def testCoreTree_BuildTree(dummyGUI, dummyItems): # END Test testCoreTree_BuildTree + @pytest.mark.core def testCoreTree_Methods(dummyGUI, dummyItems): """Test bvarious class methods. @@ -258,6 +260,7 @@ def testCoreTree_Methods(dummyGUI, dummyItems): # END Test testCoreTree_Methods + @pytest.mark.core def testCoreTree_UpdateItemLayout(dummyGUI, dummyItems): """Test building a project tree from a list of items. @@ -383,6 +386,7 @@ def testCoreTree_UpdateItemLayout(dummyGUI, dummyItems): # END Test testCoreTree_UpdateItemLayout + @pytest.mark.core def testCoreTree_MakeHandles(monkeypatch, dummyGUI): """Test generating item handles. @@ -425,6 +429,7 @@ def testCoreTree_MakeHandles(monkeypatch, dummyGUI): # END Test testCoreTree_MakeHandles + @pytest.mark.core def testCoreTree_Stats(dummyGUI, dummyItems): """Test project stats methods. @@ -451,6 +456,7 @@ def testCoreTree_Stats(dummyGUI, dummyItems): # END Test testCoreTree_Stats + @pytest.mark.core def testCoreTree_Reorder(dummyGUI, dummyItems): """Test changing tree order. @@ -482,6 +488,7 @@ def testCoreTree_Reorder(dummyGUI, dummyItems): # END Test testCoreTree_Reorder + @pytest.mark.core def testCoreTree_XMLPackUnpack(dummyGUI, dummyItems): """Test packing and unpacking the tree to and from XML. @@ -537,6 +544,7 @@ def testCoreTree_XMLPackUnpack(dummyGUI, dummyItems): # END Test testCoreTree_XMLPackUnpack + @pytest.mark.core def testCoreTree_ToCFile(monkeypatch, dummyGUI, dummyItems, tmpDir): """Test writing the ToC.txt file. diff --git a/tests/test_dialogs/test_dlg_about.py b/tests/test_dialogs/test_dlg_about.py index d951e81a..4b9ed5ee 100644 --- a/tests/test_dialogs/test_dlg_about.py +++ b/tests/test_dialogs/test_dlg_about.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – About Dialog Class Tester ======================================= @@ -32,6 +31,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testDlgAbout_Dialog(qtbot, monkeypatch, nwGUI): """Test the full about dialogs. diff --git a/tests/test_dialogs/test_dlg_dialogs.py b/tests/test_dialogs/test_dlg_dialogs.py index a60be95f..7faa48b1 100644 --- a/tests/test_dialogs/test_dlg_dialogs.py +++ b/tests/test_dialogs/test_dlg_dialogs.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Other Dialog Classes Tester ========================================= @@ -31,6 +30,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testDlgOther_QuoteSelect(qtbot, monkeypatch, nwGUI, nwMinimal): """Test the quote symbols dialog. diff --git a/tests/test_dialogs/test_dlg_itemeditor.py b/tests/test_dialogs/test_dlg_itemeditor.py index 9a9e6d66..d955b1f4 100644 --- a/tests/test_dialogs/test_dlg_itemeditor.py +++ b/tests/test_dialogs/test_dlg_itemeditor.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Item Editor Dialog Class Tester ============================================= @@ -36,6 +35,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testDlgItemEditor_Dialog(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDir): """Test the full item editor dialog. diff --git a/tests/test_dialogs/test_dlg_merge.py b/tests/test_dialogs/test_dlg_merge.py index 52e8e892..8cc0eda9 100644 --- a/tests/test_dialogs/test_dlg_merge.py +++ b/tests/test_dialogs/test_dlg_merge.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Merge and Split Dialog Classes Tester =================================================== @@ -36,6 +35,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testDlgMerge_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj): """Test the merge documents tool. diff --git a/tests/test_dialogs/test_dlg_preferences.py b/tests/test_dialogs/test_dlg_preferences.py index 1847dae2..5ba8cdc2 100644 --- a/tests/test_dialogs/test_dlg_preferences.py +++ b/tests/test_dialogs/test_dlg_preferences.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Preferences Dialog Class Tester ============================================= @@ -40,6 +39,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testDlgPreferences_Main(qtbot, monkeypatch, fncDir, outDir, refDir): """Test the load project wizard. diff --git a/tests/test_dialogs/test_dlg_projload.py b/tests/test_dialogs/test_dlg_projload.py index d552cc88..f02e4354 100644 --- a/tests/test_dialogs/test_dlg_projload.py +++ b/tests/test_dialogs/test_dlg_projload.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Project Load Dialog Class Tester ============================================== @@ -37,6 +36,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testDlgLoadProject_Main(qtbot, monkeypatch, nwGUI, nwMinimal): """Test the load project wizard. diff --git a/tests/test_dialogs/test_dlg_projsettings.py b/tests/test_dialogs/test_dlg_projsettings.py index b753959e..bdceb4bd 100644 --- a/tests/test_dialogs/test_dlg_projsettings.py +++ b/tests/test_dialogs/test_dlg_projsettings.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Project Settings Dialog Class Tester ================================================== @@ -38,6 +37,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testDlgProjSettings_Dialog(qtbot, monkeypatch, nwGUI, fncDir, fncProj, outDir, refDir): """Test the full project settings dialog. diff --git a/tests/test_dialogs/test_dlg_split.py b/tests/test_dialogs/test_dlg_split.py index 87d2f837..588cba24 100644 --- a/tests/test_dialogs/test_dlg_split.py +++ b/tests/test_dialogs/test_dlg_split.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Merge and Split Dialog Classes Tester =================================================== @@ -37,6 +36,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testDlgSplit_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj): """Test the split document tool. diff --git a/tests/test_dialogs/test_dlg_wordlist.py b/tests/test_dialogs/test_dlg_wordlist.py index 31cfb9e0..79baaab7 100644 --- a/tests/test_dialogs/test_dlg_wordlist.py +++ b/tests/test_dialogs/test_dlg_wordlist.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Other Dialog Classes Tester ========================================= @@ -35,6 +34,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + def testDlgWordList_Dialog(qtbot, monkeypatch, nwGUI, nwMinimal, tmpDir): """test the word list editor. """ diff --git a/tests/test_gui/test_gui_doceditor.py b/tests/test_gui/test_gui_doceditor.py index af28535c..176c0276 100644 --- a/tests/test_gui/test_gui_doceditor.py +++ b/tests/test_gui/test_gui_doceditor.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Main GUI Editor Class Tester ========================================== @@ -39,6 +38,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir): """Test the document editor. @@ -353,6 +353,7 @@ def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir): # END Test testGuiEditor_Main + @pytest.mark.gui def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum): """Test the document editor search functionality. diff --git a/tests/test_gui/test_gui_docviewer.py b/tests/test_gui/test_gui_docviewer.py index 8af6ccbc..86ccac26 100644 --- a/tests/test_gui/test_gui_docviewer.py +++ b/tests/test_gui/test_gui_docviewer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Main GUI Viewer Class Tester ========================================== @@ -32,6 +31,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, nwLipsum): """Test the document viewer. diff --git a/tests/test_gui/test_gui_mainmenu.py b/tests/test_gui/test_gui_mainmenu.py index 752e596e..def3ae9f 100644 --- a/tests/test_gui/test_gui_mainmenu.py +++ b/tests/test_gui/test_gui_mainmenu.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Main GUI Main Menu Class Tester ============================================= @@ -35,6 +34,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum): """Test the main menu Edit and Format entries. @@ -368,6 +368,7 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum): # END Test testGuiMenu_EditFormat + @pytest.mark.gui def testGuiMenu_ContextMenus(qtbot, monkeypatch, nwGUI, nwLipsum): """Test the context menus. @@ -452,6 +453,7 @@ def testGuiMenu_ContextMenus(qtbot, monkeypatch, nwGUI, nwLipsum): # END Test testGuiMenu_ContextMenus + @pytest.mark.gui def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj): """Test the Insert menu. diff --git a/tests/test_gui/test_gui_noveltree.py b/tests/test_gui/test_gui_noveltree.py index 57f83fe5..a991f939 100644 --- a/tests/test_gui/test_gui_noveltree.py +++ b/tests/test_gui/test_gui_noveltree.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Main GUI Novel Tree Class Tester ============================================== @@ -28,6 +27,7 @@ from tools import writeFile from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QMessageBox + @pytest.mark.gui def testGuiNovelTree_TreeItems(qtbot, caplog, monkeypatch, nwGUI, nwMinimal): """Test navigating the novel tree. diff --git a/tests/test_gui/test_gui_outline.py b/tests/test_gui/test_gui_outline.py index 507ad410..21e13b94 100644 --- a/tests/test_gui/test_gui_outline.py +++ b/tests/test_gui/test_gui_outline.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Main GUI Outline Class Tester =========================================== @@ -31,6 +30,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testGuiOutline_Main(qtbot, monkeypatch, nwGUI, nwLipsum): """Test the outline view. diff --git a/tests/test_gui/test_gui_projdetails.py b/tests/test_gui/test_gui_projdetails.py index e0ead1f9..bb523cf1 100644 --- a/tests/test_gui/test_gui_projdetails.py +++ b/tests/test_gui/test_gui_projdetails.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Project Details Dialog Class Tester ================================================= @@ -32,6 +31,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testGuiProjDetails_Dialog(qtbot, monkeypatch, nwGUI, nwLipsum): """Test the project details dialog. diff --git a/tests/test_gui/test_gui_projtree.py b/tests/test_gui/test_gui_projtree.py index c595eaf1..7652657f 100644 --- a/tests/test_gui/test_gui_projtree.py +++ b/tests/test_gui/test_gui_projtree.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Main GUI Project Tree Class Tester ================================================ @@ -32,6 +31,7 @@ from nw.guimain import GuiMain from nw.gui.projtree import GuiProjectTree from nw.enum import nwItemType, nwItemClass + @pytest.mark.gui def testGuiProjTree_TreeItems(qtbot, caplog, monkeypatch, nwGUI, nwMinimal): """Test adding and removing items from the project tree. diff --git a/tests/test_gui/test_gui_theme.py b/tests/test_gui/test_gui_theme.py index cb9c993b..875d2bf6 100644 --- a/tests/test_gui/test_gui_theme.py +++ b/tests/test_gui/test_gui_theme.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – GUI Theme and Icons Classes Tester ================================================ @@ -30,6 +29,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testGuiTheme_Main(qtbot, monkeypatch, nwMinimal, tmpDir): """Test the theme and icon classes. diff --git a/tests/test_tools/test_tools_build.py b/tests/test_tools/test_tools_build.py index 46865368..56ba58c3 100644 --- a/tests/test_tools/test_tools_build.py +++ b/tests/test_tools/test_tools_build.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Build Dialog Class Tester ======================================= @@ -35,6 +34,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testToolBuild_Main(qtbot, monkeypatch, nwGUI, nwLipsum, refDir, outDir): """Test the build tool. diff --git a/tests/test_tools/test_tools_projwizard.py b/tests/test_tools/test_tools_projwizard.py index 52ab91ff..79d41692 100644 --- a/tests/test_tools/test_tools_projwizard.py +++ b/tests/test_tools/test_tools_projwizard.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – New Project Wizard Class Tester ============================================= @@ -39,6 +38,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testToolProjectWizard_Main(qtbot, monkeypatch, nwGUI, nwMinimal): """Test the new project wizard. diff --git a/tests/test_tools/test_tools_writingstats.py b/tests/test_tools/test_tools_writingstats.py index 10f4fddc..09008d96 100644 --- a/tests/test_tools/test_tools_writingstats.py +++ b/tests/test_tools/test_tools_writingstats.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Writing Stats Dialog Class Tester =============================================== @@ -37,6 +36,7 @@ keyDelay = 2 typeDelay = 1 stepDelay = 20 + @pytest.mark.gui def testToolWritingStats_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj): """Test the full writing stats tool. diff --git a/tests/tools.py b/tests/tools.py index b375f671..6c8b2512 100644 --- a/tests/tools.py +++ b/tests/tools.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ novelWriter – Test Suite Tools ============================== @@ -25,6 +24,7 @@ import shutil from PyQt5.QtWidgets import qApp + def cmpFiles(fileOne, fileTwo, ignoreLines=None): """Compare two files, but optionally ignore lines given by a list. """ @@ -70,6 +70,7 @@ def cmpFiles(fileOne, fileTwo, ignoreLines=None): return not diffFound + def getGuiItem(theName): """Returns a QtWidget based on its objectName. """ @@ -78,18 +79,21 @@ def getGuiItem(theName): return qWidget return None + def readFile(fileName): """Returns the content of a file as a string. """ with open(fileName, mode="r", encoding="utf8") as inFile: return inFile.read() + def writeFile(fileName, fileData): """Write the contents of a string to a file. """ with open(fileName, mode="w", encoding="utf8") as outFile: outFile.write(fileData) + def cleanProject(projPath): """Delete all generated files in a project. """