mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
tests: fix TestCapabilities.testCPUMap
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.
This commit is contained in:
parent
8fa2aad1d3
commit
7594cef35f
@ -20,6 +20,7 @@ import unittest
|
|||||||
|
|
||||||
from tests import utils
|
from tests import utils
|
||||||
from virtinst import CapabilitiesParser as capabilities
|
from virtinst import CapabilitiesParser as capabilities
|
||||||
|
from virtinst.capabilities import _CPUMapFileValues
|
||||||
|
|
||||||
|
|
||||||
def build_host_feature_dict(feature_list):
|
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)
|
test_utils(new_caps_no_kvm, False, True, False, False, False)
|
||||||
|
|
||||||
def testCPUMap(self):
|
def testCPUMap(self):
|
||||||
|
_CPUMapFileValues._cpu_filename = "tests/capabilities-xml/cpu_map.xml"
|
||||||
caps = self._buildCaps("libvirt-0.7.6-qemu-caps.xml")
|
caps = self._buildCaps("libvirt-0.7.6-qemu-caps.xml")
|
||||||
cpu_64 = caps.get_cpu_values(None, "x86_64")
|
cpu_64 = caps.get_cpu_values(None, "x86_64")
|
||||||
cpu_32 = caps.get_cpu_values(None, "i486")
|
cpu_32 = caps.get_cpu_values(None, "i486")
|
||||||
|
@ -102,11 +102,12 @@ class _CPUMapFileValues(_CPUAPIValues):
|
|||||||
Fallback method to lists cpu models, parsed directly from libvirt's local
|
Fallback method to lists cpu models, parsed directly from libvirt's local
|
||||||
cpu_map.xml
|
cpu_map.xml
|
||||||
"""
|
"""
|
||||||
|
_cpu_filename = "/usr/share/libvirt/cpu_map.xml"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
_CPUAPIValues.__init__(self)
|
_CPUAPIValues.__init__(self)
|
||||||
self.archmap = {}
|
self.archmap = {}
|
||||||
cpu_filename = "/usr/share/libvirt/cpu_map.xml"
|
xml = file(self._cpu_filename).read()
|
||||||
xml = file(cpu_filename).read()
|
|
||||||
|
|
||||||
util.parse_node_helper(xml, "cpus",
|
util.parse_node_helper(xml, "cpus",
|
||||||
self._parseXML,
|
self._parseXML,
|
||||||
|
Loading…
Reference in New Issue
Block a user