Update tests
This commit is contained in:
@@ -266,7 +266,7 @@ def testWritingStatsExport(qtbot, monkeypatch, yesToAll, nwFuncTemp, nwTemp):
|
||||
|
||||
jsonStats = os.path.join(nwFuncTemp, "sessionStats.json")
|
||||
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
||||
jsonData = json.loads(inFile.read())
|
||||
jsonData = json.load(inFile)
|
||||
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
@@ -301,7 +301,7 @@ def testWritingStatsExport(qtbot, monkeypatch, yesToAll, nwFuncTemp, nwTemp):
|
||||
|
||||
jsonStats = os.path.join(nwFuncTemp, "sessionStats.json")
|
||||
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
||||
jsonData = json.loads(inFile.read())
|
||||
jsonData = json.load(inFile)
|
||||
|
||||
assert len(jsonData) == 2
|
||||
assert jsonData[1]["length"] >= 14.0
|
||||
@@ -318,7 +318,7 @@ def testWritingStatsExport(qtbot, monkeypatch, yesToAll, nwFuncTemp, nwTemp):
|
||||
|
||||
jsonStats = os.path.join(nwFuncTemp, "sessionStats.json")
|
||||
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
||||
jsonData = json.loads(inFile.read())
|
||||
jsonData = json.load(inFile)
|
||||
|
||||
assert len(jsonData) == 3
|
||||
|
||||
@@ -331,7 +331,7 @@ def testWritingStatsExport(qtbot, monkeypatch, yesToAll, nwFuncTemp, nwTemp):
|
||||
|
||||
jsonStats = os.path.join(nwFuncTemp, "sessionStats.json")
|
||||
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
||||
jsonData = json.loads(inFile.read())
|
||||
jsonData = json.load(inFile)
|
||||
|
||||
assert len(jsonData) == 4
|
||||
|
||||
@@ -343,7 +343,7 @@ def testWritingStatsExport(qtbot, monkeypatch, yesToAll, nwFuncTemp, nwTemp):
|
||||
|
||||
jsonStats = os.path.join(nwFuncTemp, "sessionStats.json")
|
||||
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
||||
jsonData = json.loads(inFile.read())
|
||||
jsonData = json.load(inFile)
|
||||
|
||||
# Check against both 1 and 2 as this can be 2 if test was started just before midnight.
|
||||
# A failed test should in any case produce a 4
|
||||
|
||||
+2
-3
@@ -27,7 +27,6 @@ def testIndexBuildCheck(monkeypatch, nwLipsum, nwDummy, nwTempProj, nwRef):
|
||||
theProject.projTree.setSeed(42)
|
||||
assert theProject.openProject(nwLipsum)
|
||||
|
||||
theProject.mainConf.debugInfo = True
|
||||
monkeypatch.setattr("nw.core.index.time", lambda: 123.4)
|
||||
|
||||
theIndex = NWIndex(theProject, nwDummy)
|
||||
@@ -49,7 +48,7 @@ def testIndexBuildCheck(monkeypatch, nwLipsum, nwDummy, nwTempProj, nwRef):
|
||||
raise Exception
|
||||
|
||||
# Make the save fail
|
||||
monkeypatch.setattr(json, "dumps", doPanic)
|
||||
monkeypatch.setattr(json, "dump", doPanic)
|
||||
assert not theIndex.saveIndex()
|
||||
|
||||
# Make the save pass
|
||||
@@ -83,7 +82,7 @@ def testIndexBuildCheck(monkeypatch, nwLipsum, nwDummy, nwTempProj, nwRef):
|
||||
assert not theIndex.textCounts
|
||||
|
||||
# Make the load fail
|
||||
monkeypatch.setattr(json, "loads", doPanic)
|
||||
monkeypatch.setattr(json, "load", doPanic)
|
||||
assert not theIndex.loadIndex()
|
||||
|
||||
# Make the load pass
|
||||
|
||||
Reference in New Issue
Block a user