2014-01-20 17:09:13 +01:00
# Copyright (C) 2013, 2014 Red Hat, Inc.
2013-03-17 17:06:52 -04:00
#
2018-04-04 14:35:41 +01:00
# This work is licensed under the GNU GPLv2 or later.
2018-03-20 15:00:02 -04:00
# See the COPYING file in the top-level directory.
2013-03-17 17:06:52 -04:00
2013-08-06 14:58:43 -04:00
import imp
2013-03-17 17:06:52 -04:00
import os
2013-03-17 18:18:22 -04:00
2016-04-18 16:42:12 -04:00
# Need to do this before any tests or virtinst import
2013-10-02 18:42:51 -04:00
os . environ [ " VIRTINST_TEST_SUITE " ] = " 1 "
2019-05-15 13:06:29 -04:00
# Need to do this before we import argcomplete
os . environ . pop ( " _ARC_DEBUG " , None )
2013-07-12 15:16:29 -04:00
2016-04-18 16:42:12 -04:00
# pylint: disable=wrong-import-position
2019-06-14 16:34:00 -04:00
from virtinst import buildconfig
2019-12-11 17:34:03 -05:00
from virtinst import log , reset_logging
2013-10-02 18:42:51 -04:00
# This sets all the cli bits back to their defaults
2019-06-14 16:34:00 -04:00
imp . reload ( buildconfig )
2013-07-17 08:14:34 +02:00
2013-03-17 18:18:22 -04:00
from tests import utils
2013-03-17 17:06:52 -04:00
2020-01-26 17:12:09 -05:00
# pylint: disable=ungrouped-imports
from virtinst import virtinstall
from virtinst import virtclone
from virtinst import virtxml
2013-03-17 17:06:52 -04:00
2018-02-22 13:46:24 -05:00
def setup_logging ( ) :
2019-06-16 21:12:39 -04:00
import logging
2019-12-11 17:34:03 -05:00
reset_logging ( )
2013-08-06 14:58:43 -04:00
2019-07-16 16:36:31 -04:00
fmt = " %(levelname)-8s %(message)s "
streamHandler = logging . StreamHandler ( )
streamHandler . setFormatter ( logging . Formatter ( fmt ) )
2020-07-17 16:02:45 -04:00
if utils . TESTCONFIG . debug :
2019-07-16 16:36:31 -04:00
streamHandler . setLevel ( logging . DEBUG )
2020-07-18 18:12:13 -04:00
log . setLevel ( logging . DEBUG )
2017-02-23 18:47:57 -05:00
else :
2019-07-16 16:36:31 -04:00
streamHandler . setLevel ( logging . ERROR )
2020-07-18 18:12:13 -04:00
log . setLevel ( logging . ERROR )
2019-07-16 16:36:31 -04:00
log . addHandler ( streamHandler )