Update current tests

This commit is contained in:
Veronica Berglyd Olsen
2024-06-16 00:37:21 +02:00
parent ea247c5814
commit 35632abea3
4 changed files with 8 additions and 13 deletions
-4
View File
@@ -181,7 +181,6 @@ class Config:
self.fmtPadThin = False self.fmtPadThin = False
# User Paths # User Paths
self._lastPath = self._homePath # The user's last used path
self._backupPath = self._backPath # Backup path to use, can be none self._backupPath = self._backPath # Backup path to use, can be none
# Spell Checking Settings # Spell Checking Settings
@@ -518,7 +517,6 @@ class Config:
logger.debug("Data Path: %s", self._dataPath) logger.debug("Data Path: %s", self._dataPath)
logger.debug("App Root: %s", self._appRoot) logger.debug("App Root: %s", self._appRoot)
logger.debug("App Path: %s", self._appPath) logger.debug("App Path: %s", self._appPath)
logger.debug("Last Path: %s", self._lastPath)
logger.debug("PDF Manual: %s", self.pdfDocs) logger.debug("PDF Manual: %s", self.pdfDocs)
# If the config and data folders don't exist, create them # If the config and data folders don't exist, create them
@@ -603,7 +601,6 @@ class Config:
self.hideHScroll = conf.rdBool(sec, "hidehscroll", self.hideHScroll) self.hideHScroll = conf.rdBool(sec, "hidehscroll", self.hideHScroll)
self.lastNotes = conf.rdStr(sec, "lastnotes", self.lastNotes) self.lastNotes = conf.rdStr(sec, "lastnotes", self.lastNotes)
self.nativeFont = conf.rdBool(sec, "nativefont", self.nativeFont) self.nativeFont = conf.rdBool(sec, "nativefont", self.nativeFont)
self._lastPath = conf.rdPath(sec, "lastpath", self._lastPath)
# Sizes # Sizes
sec = "Sizes" sec = "Sizes"
@@ -713,7 +710,6 @@ class Config:
"hidehscroll": str(self.hideHScroll), "hidehscroll": str(self.hideHScroll),
"lastnotes": str(self.lastNotes), "lastnotes": str(self.lastNotes),
"nativefont": str(self.nativeFont), "nativefont": str(self.nativeFont),
"lastpath": str(self._lastPath),
} }
conf["Sizes"] = { conf["Sizes"] = {
+1 -1
View File
@@ -50,7 +50,7 @@ def resetConfigVars():
"""Reset the CONFIG object and set various values for testing to """Reset the CONFIG object and set various values for testing to
prevent interfering with local OS. prevent interfering with local OS.
""" """
CONFIG.setLastPath(_TMP_ROOT) # CONFIG.setLastPath(_TMP_ROOT)
CONFIG.setBackupPath(_TMP_ROOT) CONFIG.setBackupPath(_TMP_ROOT)
CONFIG.setGuiFont(None) CONFIG.setGuiFont(None)
CONFIG.setTextFont(None) CONFIG.setTextFont(None)
+1 -2
View File
@@ -1,5 +1,5 @@
[Meta] [Meta]
timestamp = 2024-05-20 16:48:20 timestamp = 2024-06-16 00:36:27
[Main] [Main]
font = font =
@@ -10,7 +10,6 @@ hidevscroll = False
hidehscroll = False hidehscroll = False
lastnotes = 0x0 lastnotes = 0x0
nativefont = True nativefont = True
lastpath =
[Sizes] [Sizes]
mainwindow = 1200, 650 mainwindow = 1200, 650
+6 -6
View File
@@ -213,21 +213,21 @@ def testBaseConfig_Methods(fncPath):
assert tstConf.assetPath("stuff") == appPath / "assets" / "stuff" assert tstConf.assetPath("stuff") == appPath / "assets" / "stuff"
# Last Path # Last Path
assert tstConf.lastPath() == Path.home().absolute() assert tstConf.lastPath("project") == Path.home().absolute()
tmpStuff = fncPath / "stuff" tmpStuff = fncPath / "stuff"
tmpStuff.mkdir() tmpStuff.mkdir()
tstConf.setLastPath(tmpStuff) tstConf.setLastPath("project", tmpStuff)
assert tstConf.lastPath() == tmpStuff assert tstConf.lastPath("project") == tmpStuff
fileStuff = tmpStuff / "more_stuff.txt" fileStuff = tmpStuff / "more_stuff.txt"
fileStuff.write_text("Stuff") fileStuff.write_text("Stuff")
tstConf.setLastPath(fileStuff) tstConf.setLastPath("project", fileStuff)
assert tstConf.lastPath() == tmpStuff assert tstConf.lastPath("project") == tmpStuff
fileStuff.unlink() fileStuff.unlink()
tmpStuff.rmdir() tmpStuff.rmdir()
assert tstConf.lastPath() == Path.home().absolute() assert tstConf.lastPath("project") == Path.home().absolute()
# Backup Path # Backup Path
assert tstConf.backupPath() == tstConf._backPath assert tstConf.backupPath() == tstConf._backPath