From 0adae891a6156390959aec8ec1b2fb797c4f6969 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 20 Feb 2018 13:00:24 -0500 Subject: [PATCH] tests: Use testdefault more --- tests/capabilities.py | 2 +- tests/osdict.py | 2 +- tests/xmlconfig.py | 16 ++++++++++------ tests/xmlparse.py | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/capabilities.py b/tests/capabilities.py index 40f9fd868..f71358169 100644 --- a/tests/capabilities.py +++ b/tests/capabilities.py @@ -24,7 +24,7 @@ from virtinst import Capabilities from virtinst import DomainCapabilities -conn = utils.open_testdriver() +conn = utils.open_testdefault() class TestCapabilities(unittest.TestCase): diff --git a/tests/osdict.py b/tests/osdict.py index 54c34e610..6fa63ea70 100644 --- a/tests/osdict.py +++ b/tests/osdict.py @@ -47,7 +47,7 @@ class TestOSDB(unittest.TestCase): (osobj.name, osobj.get_typename())) def test_recommended_resources(self): - conn = utils.open_testdriver() + conn = utils.open_testdefault() guest = conn.caps.lookup_virtinst_guest() assert not OSDB.lookup_os("generic").get_recommended_resources(guest) diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py index e55b1e516..f37d861ce 100644 --- a/tests/xmlconfig.py +++ b/tests/xmlconfig.py @@ -25,12 +25,18 @@ from virtcli import CLIConfig 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): - if conn is None: - conn = _default_conn + if not 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.type = "kvm" @@ -45,8 +51,6 @@ def _make_guest(installer=None, conn=None, os_variant=None): g.features.pae = False g.vcpus = 5 - if not installer: - installer = _make_installer(conn=conn) g.installer = installer g.emulator = "/usr/lib/xen/bin/qemu-dm" 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): - conn = conn or _default_conn + conn = conn or _feature_conn inst = virtinst.DistroInstaller(conn) if location: inst.location = location diff --git a/tests/xmlparse.py b/tests/xmlparse.py index ef12eb516..7c2c6ca2d 100644 --- a/tests/xmlparse.py +++ b/tests/xmlparse.py @@ -23,7 +23,7 @@ import virtinst from tests import utils -conn = utils.open_testdriver() +conn = utils.open_testdefault() kvmconn = utils.open_kvm() @@ -1404,7 +1404,7 @@ class XMLParseTest(unittest.TestCase): # Make sure our XML engine doesn't mangle non-libvirt XML bits infile = "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)