From 0d130d2da0754c546f654ede99a79aac2b8e6c5f Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Fri, 28 Oct 2022 15:15:59 +0200 Subject: tests: Make the tests pass for Python < 3.8 Before Python 3.8, xml.dom.minidom sorted the attributes of an element when writing it to a file, while later versions output the attributes in the order they were created. Avoid these differences by sorting the attributes for each element before comparing the generated manifests with the expected ones. This corresponds to commit 5d58c18, but for new tests introduced since it was integrated. Change-Id: I5c360656a0968e6e8d57eb068c8e87da7dfa61c1 Signed-off-by: Peter Kjellerstedt Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/349917 Reviewed-by: LaMont Jones --- tests/test_manifest_xml.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/test_manifest_xml.py') diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index e181b642..06328661 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py @@ -262,10 +262,10 @@ class XmlManifestTests(ManifestParseTestCase): '' '') self.assertEqual( - manifest.ToXml(omit_local=True).toxml(), + sort_attributes(manifest.ToXml(omit_local=True).toxml()), '' - '' - '') + '' + '') def test_toxml_with_local(self): """Does include local_manifests projects when omit_local=False.""" @@ -277,11 +277,11 @@ class XmlManifestTests(ManifestParseTestCase): '' '') self.assertEqual( - manifest.ToXml(omit_local=False).toxml(), + sort_attributes(manifest.ToXml(omit_local=False).toxml()), '' - '' - '' - '') + '' + '' + '') def test_repo_hooks(self): """Check repo-hooks settings.""" -- cgit v1.2.3-54-g00ecf