diff --git a/tests/__init__.py b/tests/__init__.py index ed5cf581..45aaf214 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -30,14 +30,6 @@ reload(cliconfig) from tests import utils -# pylint: disable=protected-access -# Access to protected member, needed to unittest stuff - -# Force certain helpers to return consistent values -import virtinst -virtinst.util.is_blktap_capable = lambda ignore: False -virtinst.util.default_bridge = lambda ignore1: "eth0" - # Setup logging rootLogger = logging.getLogger() for handler in rootLogger.handlers: diff --git a/virtinst/util.py b/virtinst/util.py index 54e09e9d..baf671c5 100644 --- a/virtinst/util.py +++ b/virtinst/util.py @@ -217,6 +217,9 @@ def generate_name(base, collision_cb, suffix="", lib_collision=True, def default_bridge(conn): + if "VIRTINST_TEST_SUITE" in os.environ: + return "eth0" + if conn.is_remote(): return None @@ -327,11 +330,12 @@ def is_blktap_capable(conn): if _host_blktap_capable is not None: return _host_blktap_capable - lines = file("/proc/modules").readlines() - for line in lines: - if line.startswith("blktap ") or line.startswith("xenblktap "): - _host_blktap_capable = True - break + if "VIRTINST_TEST_SUITE" not in os.environ: + lines = file("/proc/modules").readlines() + for line in lines: + if line.startswith("blktap ") or line.startswith("xenblktap "): + _host_blktap_capable = True + break if not _host_blktap_capable: _host_blktap_capable = False