From 652013b6221567a53d5049119498aa8475653969 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Mon, 29 May 2023 17:58:23 +0200 Subject: [PATCH] Fix last broken test --- novelwriter/common.py | 2 +- tests/files/nwProject-1.5.nwx | 56 ++++++++++++------------- tests/test_core/test_core_projectxml.py | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/novelwriter/common.py b/novelwriter/common.py index f84f22ac..f4161a31 100644 --- a/novelwriter/common.py +++ b/novelwriter/common.py @@ -569,7 +569,7 @@ class NWConfigParser(ConfigParser): # Third Party Code # =============================================================================================== # -def xmlIndent(tree, space=" ", level=0): +def xmlIndent(tree, space=" ", level=0): # pragma: no cover """The XML indent function from CPython, that was only added in Python 3.9. It is included here to support older versions of Python. https://github.com/python/cpython/blob/main/Lib/xml/etree/ElementTree.py diff --git a/tests/files/nwProject-1.5.nwx b/tests/files/nwProject-1.5.nwx index 8bee81e4..8952b63b 100644 --- a/tests/files/nwProject-1.5.nwx +++ b/tests/files/nwProject-1.5.nwx @@ -25,7 +25,7 @@ Chapter %chw%: %title% %title% Scene %ch%.%sc%: %title% - + New @@ -45,111 +45,111 @@ - + Novel - + Title Page - + Page - + Part One - + Chapter One - + Making a Scene - + Another Scene - + Interlude - + A Note on Structure - + Chapter Two - + We Found John! - + Sequel - + Title Page - + Chapter One - + Characters - + Main Characters - + John Smith - + Jane Smith - + Locations - + Earth - + Space - + Mars - + Archive - + Scenes - + Old File - + Trash - + Delete Me! diff --git a/tests/test_core/test_core_projectxml.py b/tests/test_core/test_core_projectxml.py index 4d099632..35132107 100644 --- a/tests/test_core/test_core_projectxml.py +++ b/tests/test_core/test_core_projectxml.py @@ -226,7 +226,7 @@ def testCoreProjectXML_ReadCurrent(monkeypatch, tstPaths, fncPath): # Fail saving with monkeypatch.context() as mp: - mp.setattr("pathlib.Path.write_bytes", causeOSError) + mp.setattr("xml.etree.ElementTree.ElementTree.write", causeOSError) assert xmlWriter.write(data, packedContent, timeStamp, 1000) is False assert str(xmlWriter.error) == "Mock OSError"