Added test framwork and two simple tests for the config class

This commit is contained in:
Veronica K. B. Olsen
2019-05-12 13:29:18 +02:00
parent ea34884d8c
commit 223db59e3d
3 changed files with 107 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
"""novelWriter Config Class Tester
novelWriter Config Class Tester
===================================
"""
import nw
import filecmp
from nwtools import cmpFiles
from os import path, unlink
from nw.config import Config
theConf = Config()
testDir = path.dirname(__file__)
testTemp = path.join(testDir,"temp")
testRef = path.join(testDir,"reference")
tmpConf = path.join(testTemp,"novelwriter.conf")
refConf = path.join(testRef, "novelwriter.conf")
# Clean out old stuff
if path.isfile(tmpConf):
unlink(tmpConf)
def testConfigInit():
assert theConf.initConfig(testTemp)
assert cmpFiles(tmpConf, refConf, [2])
def testConfigSave():
assert theConf.saveConfig()
assert cmpFiles(tmpConf, refConf, [2])