Files
ports/sysutils/virt-manager/patches/patch-tests_test_xmlparse_py
bluhm 6cc819c94a Repair virt-manager by not using obsolete libxml2 python bindings
anymore.  Cherry-pick commits from git master branch to use xmletree.py
backend.
OK aja
2026-03-10 17:08:11 +00:00

29 lines
1.1 KiB
Plaintext

From 766bf2ecdc5ac6853b41a36412d09c1950c700bf Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Wed, 17 Sep 2025 10:42:15 -0400
Subject: [PATCH] xmlapi: add xmletree.py backend
This is an XMLAPI backend using stock python ElementTree.
We need to extend and re-implement some of ElementTree internals
to make its output match what libvirt generates, so virt-xml edits
don't generate extraneous diffs.
This is disabled by default but will be used if libxml2 is not
installed. You can explicitly opt in to using it by setting
env var VIRTINST_XML_BACKEND=etree before virtinst is imported
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Index: tests/test_xmlparse.py
--- tests/test_xmlparse.py.orig
+++ tests/test_xmlparse.py
@@ -1008,7 +1008,7 @@ def testXMLBuilderCoverage():
# Ensure we validate root element
virtinst.DeviceDisk(conn, parsexml="<foo/>")
- with pytest.raises(Exception, match=".*xmlParseDoc.*"):
+ with pytest.raises(Exception, match=".*(xmlParseDoc|not 'int').*"):
# Ensure we validate root element
virtinst.DeviceDisk(conn, parsexml=-1)