From: Noel Power Date: Fri, 13 Mar 2020 17:32:20 +0000 (+0000) Subject: python/samba/gp_parse: Fix test errors with python3.8 X-Git-Tag: ldb-2.2.0~1383 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5406205382fa8177ea0993a5b0996dc5e7cb5abe;p=thirdparty%2Fsamba.git python/samba/gp_parse: Fix test errors with python3.8 UNEXPECTED(failure): samba.tests.samba_tool.gpo.samba.tests.samba_tool.gpo.GpoCmdTestCase.test_backup_restore_generalize(ad_dc:local) REASON: Exception: Exception: Traceback (most recent call last): File "/tmp/samba-testbase/b28/samba-ad-dc-1/bin/python/samba/tests/samba_tool/gpo.py", line 434, in test_backup_restore_generalize self.assertIsNone(has_difference(os.path.join(new_path, 'policy', This caused because prior to 3.8 minodom.toprettyxml() was sorting the attribute order, now it preserves the attribute order specified by the user Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/gp_parse/gp_pol.py b/python/samba/gp_parse/gp_pol.py index 67ecd584dc0..8a3d5f58ec1 100644 --- a/python/samba/gp_parse/gp_pol.py +++ b/python/samba/gp_parse/gp_pol.py @@ -101,9 +101,9 @@ class GPPolParser(GPParser): def write_xml(self, filename): with open(filename, 'wb') as f: root = Element('PolFile') + root.attrib['num_entries'] = str(self.pol_file.num_entries) root.attrib['signature'] = self.pol_file.header.signature root.attrib['version'] = str(self.pol_file.header.version) - root.attrib['num_entries'] = str(self.pol_file.num_entries) for entry in self.pol_file.entries: child = SubElement(root, 'Entry') # child.attrib['size'] = str(entry.size)