From 003684b6e5aad4a4f44b77a3148f24fed97f060a Mon Sep 17 00:00:00 2001 From: Daniel Kutik Date: Sun, 27 Nov 2022 13:31:48 +0100 Subject: [PATCH] test: Fix char encoding issues on windows Some tests were failing due to Windows not using utf-8 by default when executing the tests. Enforcing usage of utf-8 resolves these issues. Signed-off-by: Daniel Kutik Change-Id: If42f6be2a2b688a6105ecf4fcdb541aade24519a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/353179 Reviewed-by: Mike Frysinger --- tests/test_manifest_xml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index 0e649a67..8aa97e70 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py @@ -117,7 +117,7 @@ class ManifestParseTestCase(unittest.TestCase): def getXmlManifest(self, data): """Helper to initialize a manifest for testing.""" - with open(self.manifest_file, 'w') as fp: + with open(self.manifest_file, 'w', encoding="utf-8") as fp: fp.write(data) return manifest_xml.XmlManifest(self.repodir, self.manifest_file) @@ -428,7 +428,7 @@ class IncludeElementTests(ManifestParseTestCase): def parse(name): name = self.encodeXmlAttr(name) # Setup target of the include. - with open(os.path.join(self.manifest_dir, 'target.xml'), 'w') as fp: + with open(os.path.join(self.manifest_dir, 'target.xml'), 'w', encoding="utf-8") as fp: fp.write(f'') manifest = self.getXmlManifest("""