Use storage class to open and save project XML

This commit is contained in:
Veronica Berglyd Olsen
2022-11-03 21:51:56 +01:00
parent 96b011cf70
commit dfd9e15951
5 changed files with 129 additions and 36 deletions
+2 -2
View File
@@ -220,12 +220,12 @@ def testCoreProjectXML_ReadCurrent(monkeypatch, filesDir, fncDir, outDir, refDir
# Fail saving
with monkeypatch.context() as mp:
mp.setattr("builtins.open", causeOSError)
mp.setattr("pathlib.Path.write_bytes", causeOSError)
assert xmlWriter.write(data, packedContent, timeStamp, 1000) is False
assert str(xmlWriter.error) == "Mock OSError"
with monkeypatch.context() as mp:
mp.setattr("os.replace", causeOSError)
mp.setattr("pathlib.Path.replace", causeOSError)
assert xmlWriter.write(data, packedContent, timeStamp, 1000) is False
assert str(xmlWriter.error) == "Mock OSError"