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