[virt-tools-list] [virt-manager PATCH] tests: fix TestCapabilities.testCPUMap

Roman Bogorodskiy bogorodskiy at gmail.com
Sun Apr 6 15:06:57 UTC 2014


  Giuseppe Scrivano wrote:

> Roman Bogorodskiy <bogorodskiy at gmail.com> writes:
> 
> > testCPUMap() tries to open /usr/share/libvirt/cpu_map.xml file
> > and that fails if libvirt is not installed on the system
> > or cpu_map.xml path is different.
> >
> > Force it to use tests/capabilities-xml/cpu_map.xml file instead.
> > ---
> >  tests/capabilities.py    | 2 ++
> >  virtinst/capabilities.py | 5 +++--
> >  2 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/tests/capabilities.py b/tests/capabilities.py
> > index db69c6f..8c18993 100644
> > --- a/tests/capabilities.py
> > +++ b/tests/capabilities.py
> > @@ -20,6 +20,7 @@ import unittest
> >  
> >  from tests import utils
> >  from virtinst import CapabilitiesParser as capabilities
> > +from virtinst.capabilities import _CPUMapFileValues
> >  
> >  
> >  def build_host_feature_dict(feature_list):
> > @@ -221,6 +222,7 @@ class TestCapabilities(unittest.TestCase):
> >          test_utils(new_caps_no_kvm, False, True, False, False, False)
> >  
> >      def testCPUMap(self):
> > +        _CPUMapFileValues._cpu_filename = "tests/capabilities-xml/cpu_map.xml"
> >          caps = self._buildCaps("libvirt-0.7.6-qemu-caps.xml")
> 
> commit 81696a514441f2320ea10299e1852795f8cb1682 removed the cpu_filename
> optional argument from the CPUValues constructor.  Maybe we
> should revert partly that commit and pass cpu_filename trough __init__
> again?

That could be an option as well, but it seems we'll have to pass
cpu_filename all the way down from capabilities.Capabilities as we don't
instantiate _CPUMapFileValues directly from the test.

Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20140406/b9974f8c/attachment.sig>


More information about the virt-tools-list mailing list