mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
tests: Use testdefault more
This commit is contained in:
parent
4205272384
commit
0adae891a6
@ -24,7 +24,7 @@ from virtinst import Capabilities
|
|||||||
from virtinst import DomainCapabilities
|
from virtinst import DomainCapabilities
|
||||||
|
|
||||||
|
|
||||||
conn = utils.open_testdriver()
|
conn = utils.open_testdefault()
|
||||||
|
|
||||||
|
|
||||||
class TestCapabilities(unittest.TestCase):
|
class TestCapabilities(unittest.TestCase):
|
||||||
|
@ -47,7 +47,7 @@ class TestOSDB(unittest.TestCase):
|
|||||||
(osobj.name, osobj.get_typename()))
|
(osobj.name, osobj.get_typename()))
|
||||||
|
|
||||||
def test_recommended_resources(self):
|
def test_recommended_resources(self):
|
||||||
conn = utils.open_testdriver()
|
conn = utils.open_testdefault()
|
||||||
guest = conn.caps.lookup_virtinst_guest()
|
guest = conn.caps.lookup_virtinst_guest()
|
||||||
assert not OSDB.lookup_os("generic").get_recommended_resources(guest)
|
assert not OSDB.lookup_os("generic").get_recommended_resources(guest)
|
||||||
|
|
||||||
|
@ -25,12 +25,18 @@ from virtcli import CLIConfig
|
|||||||
from tests import utils
|
from tests import utils
|
||||||
|
|
||||||
|
|
||||||
_default_conn = utils.open_testdriver()
|
_default_conn = utils.open_testdefault()
|
||||||
|
_feature_conn = utils.open_testdriver()
|
||||||
|
|
||||||
|
|
||||||
def _make_guest(installer=None, conn=None, os_variant=None):
|
def _make_guest(installer=None, conn=None, os_variant=None):
|
||||||
if conn is None:
|
if not conn:
|
||||||
conn = _default_conn
|
if installer:
|
||||||
|
conn = installer.conn
|
||||||
|
else:
|
||||||
|
conn = _feature_conn
|
||||||
|
if not installer:
|
||||||
|
installer = _make_installer(conn=conn)
|
||||||
|
|
||||||
g = conn.caps.lookup_virtinst_guest()
|
g = conn.caps.lookup_virtinst_guest()
|
||||||
g.type = "kvm"
|
g.type = "kvm"
|
||||||
@ -45,8 +51,6 @@ def _make_guest(installer=None, conn=None, os_variant=None):
|
|||||||
g.features.pae = False
|
g.features.pae = False
|
||||||
g.vcpus = 5
|
g.vcpus = 5
|
||||||
|
|
||||||
if not installer:
|
|
||||||
installer = _make_installer(conn=conn)
|
|
||||||
g.installer = installer
|
g.installer = installer
|
||||||
g.emulator = "/usr/lib/xen/bin/qemu-dm"
|
g.emulator = "/usr/lib/xen/bin/qemu-dm"
|
||||||
g.os.arch = "i686"
|
g.os.arch = "i686"
|
||||||
@ -98,7 +102,7 @@ def _make_guest(installer=None, conn=None, os_variant=None):
|
|||||||
|
|
||||||
|
|
||||||
def _make_installer(location=None, conn=None):
|
def _make_installer(location=None, conn=None):
|
||||||
conn = conn or _default_conn
|
conn = conn or _feature_conn
|
||||||
inst = virtinst.DistroInstaller(conn)
|
inst = virtinst.DistroInstaller(conn)
|
||||||
if location:
|
if location:
|
||||||
inst.location = location
|
inst.location = location
|
||||||
|
@ -23,7 +23,7 @@ import virtinst
|
|||||||
|
|
||||||
from tests import utils
|
from tests import utils
|
||||||
|
|
||||||
conn = utils.open_testdriver()
|
conn = utils.open_testdefault()
|
||||||
kvmconn = utils.open_kvm()
|
kvmconn = utils.open_kvm()
|
||||||
|
|
||||||
|
|
||||||
@ -1404,7 +1404,7 @@ class XMLParseTest(unittest.TestCase):
|
|||||||
# Make sure our XML engine doesn't mangle non-libvirt XML bits
|
# Make sure our XML engine doesn't mangle non-libvirt XML bits
|
||||||
infile = "tests/xmlparse-xml/domain-roundtrip.xml"
|
infile = "tests/xmlparse-xml/domain-roundtrip.xml"
|
||||||
outfile = "tests/xmlparse-xml/domain-roundtrip.xml"
|
outfile = "tests/xmlparse-xml/domain-roundtrip.xml"
|
||||||
guest = virtinst.Guest(kvmconn, parsexml=open(infile).read())
|
guest = virtinst.Guest(conn, parsexml=open(infile).read())
|
||||||
|
|
||||||
utils.diff_compare(guest.get_xml_config(), outfile)
|
utils.diff_compare(guest.get_xml_config(), outfile)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user