Updated existing NWProject tests

This commit is contained in:
Veronica K. B. Olsen
2020-12-04 21:28:35 +01:00
parent 91ece2b7f2
commit 57397fa2bc
9 changed files with 101 additions and 87 deletions
+14 -22
View File
@@ -51,6 +51,20 @@ def outDir(tmpDir):
os.mkdir(theDir)
return theDir
@pytest.fixture(scope="function")
def fncDir(tmpDir):
"""A temporary folder for a single test function.
"""
funcDir = os.path.join(tmpDir, "ftemp")
if os.path.isdir(funcDir):
shutil.rmtree(funcDir)
if not os.path.isdir(funcDir):
os.mkdir(funcDir)
yield funcDir
if os.path.isdir(funcDir):
shutil.rmtree(funcDir)
return
##
# novelWriter Objects
##
@@ -158,32 +172,10 @@ def yesToAll(monkeypatch):
# =============================================================================================== #
##
# novelWriter Objects
##
@pytest.fixture(scope="session")
def nwConf(refDir, tmpDir):
"""Temporary novelWriter configuration used for the dummy instance
of novelWriter's main GUI.
"""
theConf = Config()
theConf.initConfig(refDir, tmpDir)
return theConf
##
# Temporary Test Folders
##
@pytest.fixture(scope="session")
def nwTempProj(tmpDir):
"""A temporary folder for project tests.
"""
projDir = os.path.join(tmpDir, "proj")
if not os.path.isdir(projDir):
os.mkdir(projDir)
return projDir
@pytest.fixture(scope="session")
def nwTempGUI(tmpDir):
"""A temporary folder for GUI tests.