Rename lastPath in build settings

This commit is contained in:
Veronica Berglyd Olsen
2024-06-16 11:23:59 +02:00
parent a3381f1f79
commit 14f1697428
4 changed files with 22 additions and 22 deletions
+14 -14
View File
@@ -73,29 +73,29 @@ def testCoreBuildSettings_ClassAttributes(fncPath: Path):
assert isUUID(build.buildID)
# Last path must be valid, if not it defaults to $HOME
build.setLastPath("/path/to/nowhere")
assert build.lastPath == CONFIG.homePath()
build.setLastBuildPath("/path/to/nowhere")
assert build.lastBuildPath == CONFIG.homePath()
build.setLastPath(None)
assert build.lastPath == CONFIG.homePath()
build.setLastBuildPath(None)
assert build.lastBuildPath == CONFIG.homePath()
(fncPath / "test.txt").write_text("foobar")
build.setLastPath(fncPath / "test.txt") # Can't be a file
assert build.lastPath == CONFIG.homePath()
build.setLastBuildPath(fncPath / "test.txt") # Can't be a file
assert build.lastBuildPath == CONFIG.homePath()
build.setLastPath(fncPath)
assert build.lastPath == fncPath
build.setLastBuildPath(fncPath)
assert build.lastBuildPath == fncPath
build.setLastPath(str(fncPath)) # String paths are also ok
assert build.lastPath == fncPath
build.setLastBuildPath(str(fncPath)) # String paths are also ok
assert build.lastBuildPath == fncPath
# Last path no longer exists -> fallback to $HOME
testDir = fncPath / "test_dir"
testDir.mkdir()
build.setLastPath(testDir)
assert build.lastPath == testDir
build.setLastBuildPath(testDir)
assert build.lastBuildPath == testDir
testDir.rmdir()
assert build.lastPath == CONFIG.homePath()
assert build.lastBuildPath == CONFIG.homePath()
# Last build name
build.setLastBuildName(None) # type: ignore
@@ -119,7 +119,7 @@ def testCoreBuildSettings_ClassAttributes(fncPath: Path):
# Set some sensible values
build.setName("Test Build")
build.setBuildID("5cf45d24-f496-42c9-8733-529a9e52a62b")
build.setLastPath(fncPath)
build.setLastBuildPath(fncPath)
build.setLastBuildName("Build Name")
build.setLastFormat(nwBuildFmt.HTML)
+2 -2
View File
@@ -47,7 +47,7 @@ def testToolManuscriptBuild_Main(
buildTestProject(nwGUI, projPath)
nwGUI.openProject(projPath)
build = BuildSettings()
build.setLastPath(fncPath)
build.setLastBuildPath(fncPath)
manus = GuiManuscriptBuild(nwGUI, build)
manus.show()
@@ -100,7 +100,7 @@ def testToolManuscriptBuild_Main(
assert build.lastBuildName == "TestBuild"
assert build.lastFormat == lastFmt
assert build.lastPath == fncPath
assert build.lastBuildPath == fncPath
# Error Handling
# ==============