cliconfig: Use default values if we're in the test suite

We were doing this by hand more or less, but this way is more future
proof.
This commit is contained in:
Cole Robinson 2013-10-02 18:42:51 -04:00
parent 18d8512699
commit c136fde04d
3 changed files with 5 additions and 3 deletions

View File

@ -20,12 +20,14 @@ import logging
import os
os.environ["VIRTINST_TEST_TRACKPROPS"] = "1"
os.environ["VIRTINST_TEST_SUITE"] = "1"
import virtinst
virtinst.enable_rhel_defaults = False
from virtcli import cliconfig
cliconfig.default_graphics = "vnc"
# This sets all the cli bits back to their defaults
reload(cliconfig)
from tests import utils

View File

@ -43,7 +43,6 @@ urikvm = uriqemu + _capsprefix + "libvirt-1.1.2-qemu-caps.xml"
urilxc = fakeuri + _capsprefix + "capabilities-lxc.xml,lxc"
os.environ["VIRTINST_TEST_SCRATCHDIR"] = os.getcwd()
os.environ["VIRTINST_TEST_SUITE"] = "1"
def get_debug():

View File

@ -29,6 +29,7 @@ cfg = ConfigParser.ConfigParser()
_filepath = os.path.abspath(__file__)
_srcdir = os.path.abspath(os.path.join(os.path.dirname(_filepath), ".."))
cfgpath = os.path.join(os.path.dirname(_filepath), "cli.cfg")
_istest = "VIRTINST_TEST_SUITE" in os.environ
if os.path.exists(cfgpath):
cfg.read(cfgpath)
@ -38,7 +39,7 @@ def _split_list(commastr):
def _get_param(name, default):
if not cfg.sections():
if _istest or not cfg.sections():
return default
return cfg.get("config", name)