Clean up a few remnants of old test code
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
# =============
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,7 +19,6 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user