tests: Enable property checking for all objects
And loosen restrictions a bit so any read/write will trigger the tracking.
This commit is contained in:
parent
1c22118179
commit
070664b9e7
|
@ -6,6 +6,8 @@ import virtinst
|
|||
|
||||
|
||||
class CheckPropsTest(unittest.TestCase):
|
||||
maxDiff = None
|
||||
|
||||
def testCheckProps(self):
|
||||
# pylint: disable=protected-access
|
||||
# Access to protected member, needed to unittest stuff
|
||||
|
|
|
@ -22,13 +22,7 @@
|
|||
import re
|
||||
|
||||
from .cpu import CPU as DomainCPU
|
||||
from .xmlbuilder import XMLBuilder, XMLChildProperty
|
||||
from .xmlbuilder import XMLProperty as _XMLProperty
|
||||
|
||||
|
||||
# Disable test suite property tracking
|
||||
class XMLProperty(_XMLProperty):
|
||||
_track = False
|
||||
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
|
||||
|
||||
##########################
|
||||
|
@ -158,7 +152,6 @@ class _CapsTopologyCPU(XMLBuilder):
|
|||
|
||||
class _TopologyCell(XMLBuilder):
|
||||
_XML_ROOT_NAME = "cell"
|
||||
id = XMLProperty("./@id")
|
||||
cpus = XMLChildProperty(_CapsTopologyCPU, relative_xpath="./cpus")
|
||||
|
||||
|
||||
|
@ -221,8 +214,6 @@ class _CapsGuestFeatures(XMLBuilder):
|
|||
|
||||
pae = XMLProperty("./pae", is_bool=True)
|
||||
nonpae = XMLProperty("./nonpae", is_bool=True)
|
||||
acpi = XMLProperty("./acpi", is_bool=True)
|
||||
apic = XMLProperty("./apci", is_bool=True)
|
||||
|
||||
|
||||
class _CapsGuest(XMLBuilder):
|
||||
|
|
|
@ -21,14 +21,7 @@
|
|||
import logging
|
||||
import re
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLChildProperty
|
||||
from .xmlbuilder import XMLProperty as _XMLProperty
|
||||
|
||||
|
||||
class XMLProperty(_XMLProperty):
|
||||
# We don't care about full parsing coverage, so tell the test suite
|
||||
# not to warn
|
||||
_track = False
|
||||
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
|
||||
|
||||
class _Value(XMLBuilder):
|
||||
|
|
|
@ -19,12 +19,7 @@
|
|||
|
||||
import logging
|
||||
|
||||
from .xmlbuilder import XMLBuilder
|
||||
from .xmlbuilder import XMLProperty as _XMLProperty
|
||||
|
||||
|
||||
class XMLProperty(_XMLProperty):
|
||||
_track = False
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
def _compare_int(nodedev_val, hostdev_val):
|
||||
|
|
|
@ -330,8 +330,6 @@ class XMLChildProperty(property):
|
|||
|
||||
|
||||
class XMLProperty(property):
|
||||
_track = True
|
||||
|
||||
def __init__(self, xpath=None, name=None, doc=None,
|
||||
set_converter=None, validate_cb=None, make_xpath_cb=None,
|
||||
is_bool=False, is_int=False, is_yesno=False, is_onoff=False,
|
||||
|
@ -401,7 +399,8 @@ class XMLProperty(property):
|
|||
if self._default_name and not self._default_cb:
|
||||
raise RuntimeError("default_name requires default_cb.")
|
||||
|
||||
if _trackprops and self._track:
|
||||
self._is_tracked = False
|
||||
if _trackprops:
|
||||
_allprops.append(self)
|
||||
|
||||
property.__init__(self, fget=self.getter, fset=self.setter)
|
||||
|
@ -527,8 +526,6 @@ class XMLProperty(property):
|
|||
propstore = xmlbuilder._propstore
|
||||
proporder = xmlbuilder._proporder
|
||||
|
||||
if _trackprops and self not in _seenprops:
|
||||
_seenprops.append(self)
|
||||
propname = self._findpropname(xmlbuilder)
|
||||
propstore[propname] = val
|
||||
|
||||
|
@ -567,6 +564,10 @@ class XMLProperty(property):
|
|||
since it's known to the empty, and we may want to return
|
||||
a 'default' value
|
||||
"""
|
||||
if _trackprops and not self._is_tracked:
|
||||
_seenprops.append(self)
|
||||
self._is_tracked = True
|
||||
|
||||
if (self._prop_is_unset(xmlbuilder) and
|
||||
not xmlbuilder._xmlstate.is_build):
|
||||
val = self._get_xml(xmlbuilder)
|
||||
|
@ -595,6 +596,10 @@ class XMLProperty(property):
|
|||
in propstore. Setting the actual XML is only done at
|
||||
get_xml_config time.
|
||||
"""
|
||||
if _trackprops and not self._is_tracked:
|
||||
_seenprops.append(self)
|
||||
self._is_tracked = True
|
||||
|
||||
if validate and self._validate_cb:
|
||||
self._validate_cb(xmlbuilder, val)
|
||||
self._nonxml_fset(xmlbuilder,
|
||||
|
|
Loading…
Reference in New Issue