summaryrefslogtreecommitdiff
path: root/virtinst/cli.py
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2016-07-20 09:31:28 -0400
committerCole Robinson <crobinso@redhat.com>2016-07-20 18:14:37 -0400
commitd70fccd2960c5c259ea3be4b03ec8ac1a5cb2ea3 (patch)
tree97c1b2e7a1fd6eeb235e2a668169249b356922c4 /virtinst/cli.py
parent322d21251630d16ab6664477c10d7442d9f222e7 (diff)
downloadvirt-manager-d70fccd2960c5c259ea3be4b03ec8ac1a5cb2ea3.tar.gz
cli: Add helper for checking if we are in the test suite
Diffstat (limited to 'virtinst/cli.py')
-rw-r--r--virtinst/cli.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 5e886cc4..1fff7425 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -182,7 +182,7 @@ def setupLogging(appname, debug_stdout, do_quiet, cli_app=True):
vi_dir = None
logfile = None
- if "VIRTINST_TEST_SUITE" not in os.environ:
+ if not _in_testsuite():
vi_dir = util.get_cache_dir()
logfile = os.path.join(vi_dir, appname + ".log")
@@ -258,6 +258,10 @@ def setupLogging(appname, debug_stdout, do_quiet, cli_app=True):
logging.debug("Launched with command line: %s", " ".join(sys.argv))
+def _in_testsuite():
+ return "VIRTINST_TEST_SUITE" in os.environ
+
+
##############################
# Libvirt connection helpers #
##############################
@@ -412,7 +416,7 @@ def validate_disk(dev, warn_overwrite=False):
def _run_console(guest, args):
logging.debug("Running: %s", " ".join(args))
- if "VIRTINST_TEST_SUITE" in os.environ:
+ if _in_testsuite():
# Add this destroy() in here to trigger more virt-install code
# for the test suite
guest.domain.destroy()
@@ -498,7 +502,7 @@ def get_console_cb(guest):
def get_meter():
- quiet = (get_global_state().quiet or "VIRTINST_TEST_SUITE" in os.environ)
+ quiet = (get_global_state().quiet or _in_testsuite())
return util.make_meter(quiet=quiet)