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