From dc12d518c0614ffeaa192fdfcd2d2853c9820416 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 23 Oct 2019 21:34:25 +0200 Subject: [PATCH] Fixed test --- nw/config.py | 5 ++++- tests/reference/novelwriter.conf | 1 + tests/test_config.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nw/config.py b/nw/config.py index cd8b5c63..722f4141 100644 --- a/nw/config.py +++ b/nw/config.py @@ -317,7 +317,10 @@ class Config: return True def setLastPath(self, lastPath): - self.lastPath = path.dirname(lastPath) + if lastPath is None or lastPath == "": + self.lastPath = "" + else: + self.lastPath = path.dirname(lastPath) return True def setWinSize(self, newWidth, newHeight): diff --git a/tests/reference/novelwriter.conf b/tests/reference/novelwriter.conf index 7ea29925..90c48661 100644 --- a/tests/reference/novelwriter.conf +++ b/tests/reference/novelwriter.conf @@ -37,6 +37,7 @@ backuponclose = False askbeforebackup = True [Path] +lastpath = recent0 = recent1 = recent2 = diff --git a/tests/test_config.py b/tests/test_config.py index 12fc5c18..4c4c2523 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -14,6 +14,8 @@ def testConfigInit(nwTemp,nwRef): tmpConf = path.join(nwTemp,"novelwriter.conf") refConf = path.join(nwRef, "novelwriter.conf") assert theConf.initConfig(nwTemp) + assert theConf.setLastPath("") + assert theConf.saveConfig() assert cmpFiles(tmpConf, refConf, [2]) assert not theConf.confChanged