The Writing Stats tool should not pop an error message if there is no satistics log

This commit is contained in:
Veronica K. B. Olsen
2020-12-17 18:52:56 +01:00
parent 1d9c4430f7
commit d9cccc8752
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -403,8 +403,12 @@ class GuiWritingStats(QDialog):
ttNotes = 0
ttTime = 0
logFile = os.path.join(self.theProject.projMeta, nwFiles.SESS_STATS)
if not os.path.isfile(logFile):
logger.info("This project has no writing stats logfile")
return False
try:
logFile = os.path.join(self.theProject.projMeta, nwFiles.SESS_STATS)
with open(logFile, mode="r", encoding="utf8") as inFile:
for inLine in inFile:
if inLine.startswith("#"):
+1
View File
@@ -203,6 +203,7 @@ def testGuiWritingStats_Dialog(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
# IOError
# =======
monkeypatch.setattr("builtins.open", causeOSError)
assert not sessLog._loadLogFile()
assert not sessLog._saveData(sessLog.FMT_CSV)
# qtbot.stopForInteraction()