diff --git a/.gitignore b/.gitignore index 20079fdc..72af1994 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,6 @@ __pycache__ /novelwriter/assets/sample.zip /sample/cache /sample/meta -/sample/versions *.bak *.lock ToC.txt @@ -44,9 +43,6 @@ ToC.txt /tests/temp /tests/lipsum/cache /tests/lipsum/meta -/tests/minimal/cache -/tests/minimal/meta -/tests/oldproj/cache /.pytest_cache /pytestdebug.log diff --git a/tests/conftest.py b/tests/conftest.py index c8c84095..a12bdecc 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -200,27 +200,6 @@ def mockRnd(monkeypatch): # Temp Project Folders ## -@pytest.fixture(scope="function") -def nwLipsum(): - """A medium sized novelWriter example project with a lot of Lorem - Ipsum text. - """ - srcDir = _TST_ROOT / "lipsum" - dstDir = _TMP_ROOT / "lipsum" - if dstDir.exists(): - shutil.rmtree(dstDir) - - shutil.copytree(srcDir, dstDir) - cleanProject(dstDir) - - yield str(dstDir) - - if dstDir.exists(): - shutil.rmtree(dstDir) - - return - - @pytest.fixture(scope="function") def prjLipsum(): """A medium sized novelWriter example project with a lot of Lorem diff --git a/tests/test_dialogs/test_dlg_projdetails.py b/tests/test_dialogs/test_dlg_projdetails.py index 50150257..8afd668e 100644 --- a/tests/test_dialogs/test_dlg_projdetails.py +++ b/tests/test_dialogs/test_dlg_projdetails.py @@ -29,11 +29,11 @@ from novelwriter.dialogs.projdetails import GuiProjectDetails @pytest.mark.gui -def testDlgProjDetails_Dialog(qtbot, nwGUI, nwLipsum): +def testDlgProjDetails_Dialog(qtbot, nwGUI, prjLipsum): """Test the project details dialog. """ # Create a project to work on - assert nwGUI.openProject(nwLipsum) + assert nwGUI.openProject(prjLipsum) assert nwGUI.rebuildIndex(beQuiet=True) qtbot.wait(100) @@ -56,7 +56,7 @@ def testDlgProjDetails_Dialog(qtbot, nwGUI, nwLipsum): assert projDet.tabMain.sceneCountVal.text() == f"{5:n}" assert projDet.tabMain.revCountVal.text() == f"{nwGUI.theProject.data.saveCount:n}" - assert projDet.tabMain.projPathVal.text() == nwLipsum + assert projDet.tabMain.projPathVal.text() == str(prjLipsum) # Contents Page # ============= diff --git a/tests/test_gui/test_gui_doceditor.py b/tests/test_gui/test_gui_doceditor.py index 1dc3610b..90032a57 100644 --- a/tests/test_gui/test_gui_doceditor.py +++ b/tests/test_gui/test_gui_doceditor.py @@ -1203,12 +1203,12 @@ def testGuiEditor_WordCounters(qtbot, monkeypatch, nwGUI, projPath, ipsumText, m @pytest.mark.gui -def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum): +def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, prjLipsum): """Test the document editor search functionality. """ monkeypatch.setattr(GuiDocEditor, "hasFocus", lambda *a: True) - assert nwGUI.openProject(nwLipsum) is True + assert nwGUI.openProject(prjLipsum) is True assert nwGUI.openDocument("4c4f28287af27") is True origText = nwGUI.docEditor.getText() diff --git a/tests/test_gui/test_gui_docviewer.py b/tests/test_gui/test_gui_docviewer.py index bb3437dd..9b524d31 100644 --- a/tests/test_gui/test_gui_docviewer.py +++ b/tests/test_gui/test_gui_docviewer.py @@ -33,11 +33,11 @@ from novelwriter.core.tohtml import ToHtml @pytest.mark.gui -def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, nwLipsum): +def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum): """Test the document viewer. """ # Open project - assert nwGUI.openProject(nwLipsum) + assert nwGUI.openProject(prjLipsum) # Rebuild the index nwGUI.mainMenu.aRebuildIndex.activate(QAction.Trigger) diff --git a/tests/test_gui/test_gui_mainmenu.py b/tests/test_gui/test_gui_mainmenu.py index 3c7cc565..2aaa851b 100644 --- a/tests/test_gui/test_gui_mainmenu.py +++ b/tests/test_gui/test_gui_mainmenu.py @@ -34,7 +34,7 @@ from novelwriter.gui.doceditor import GuiDocEditor @pytest.mark.gui -def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum): +def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, prjLipsum): """Test the main menu Edit and Format entries. """ monkeypatch.setattr(GuiDocEditor, "hasFocus", lambda *a: True) @@ -42,7 +42,7 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum): # Test Document Action with No Project assert nwGUI.docEditor.docAction(nwDocAction.COPY) is False - assert nwGUI.openProject(nwLipsum) is True + assert nwGUI.openProject(prjLipsum) is True # Split By Chapter assert nwGUI.openDocument("4c4f28287af27") is True @@ -342,10 +342,10 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum): @pytest.mark.gui -def testGuiMenu_ContextMenus(qtbot, nwGUI, nwLipsum): +def testGuiMenu_ContextMenus(qtbot, nwGUI, prjLipsum): """Test the context menus. """ - assert nwGUI.openProject(nwLipsum) + assert nwGUI.openProject(prjLipsum) assert nwGUI.openDocument("4c4f28287af27") # Editor Context Menu diff --git a/tests/test_gui/test_gui_outline.py b/tests/test_gui/test_gui_outline.py index 533a5c52..f208f246 100644 --- a/tests/test_gui/test_gui_outline.py +++ b/tests/test_gui/test_gui_outline.py @@ -19,7 +19,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import os import time import pytest @@ -152,10 +151,10 @@ def testGuiOutline_Main(qtbot, monkeypatch, nwGUI, projPath): @pytest.mark.gui -def testGuiOutline_Content(qtbot, nwGUI, nwLipsum): +def testGuiOutline_Content(qtbot, nwGUI, prjLipsum): """Test the outline view. """ - assert nwGUI.openProject(nwLipsum) + assert nwGUI.openProject(prjLipsum) nwGUI.rebuildIndex() nwGUI._changeView(nwView.OUTLINE) @@ -192,7 +191,7 @@ def testGuiOutline_Content(qtbot, nwGUI, nwLipsum): for dTitle, hLevel in docList: aHandle = nwGUI.theProject.newFile(dTitle, newHandle) hHash = "#"*hLevel - writeFile(os.path.join(nwLipsum, "content", f"{aHandle}.nwd"), f"{hHash} {dTitle}\n\n") + writeFile(prjLipsum / "content" / f"{aHandle}.nwd", f"{hHash} {dTitle}\n\n") nwGUI.projView.projTree.revealNewTreeItem(aHandle) nwGUI.rebuildIndex()