mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-06 13:17:58 +03:00
fdc621e05f
Various checks in the test suite try to match for error/status messages, so using a localized libvirt (or even using translations of an installed version of virt-manager in the system) makes those check fail. Hence, force (using $LANG, and unsetting $LANGUAGE) an English UTF-8 locale. Thanks Cole Robinson for spotting the right place where to inject the locale settings. Fixes: #199 Signed-off-by: Pino Toscano <ptoscano@redhat.com>
46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
# Copyright (C) 2013, 2014 Red Hat, Inc.
|
|
#
|
|
# This work is licensed under the GNU GPLv2 or later.
|
|
# See the COPYING file in the top-level directory.
|
|
|
|
import imp
|
|
import os
|
|
|
|
# Need to do this before any tests or virtinst import
|
|
os.environ["VIRTINST_TEST_SUITE"] = "1"
|
|
# Need to do this before we import argcomplete
|
|
os.environ.pop("_ARC_DEBUG", None)
|
|
# 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)
|
|
|
|
# pylint: disable=wrong-import-position
|
|
from virtinst import buildconfig
|
|
from virtinst import log, reset_logging
|
|
# This sets all the cli bits back to their defaults
|
|
imp.reload(buildconfig)
|
|
|
|
from tests import utils
|
|
|
|
# pylint: disable=ungrouped-imports
|
|
from virtinst import virtinstall
|
|
from virtinst import virtclone
|
|
from virtinst import virtxml
|
|
|
|
|
|
def setup_logging():
|
|
import logging
|
|
reset_logging()
|
|
|
|
fmt = "%(levelname)-8s %(message)s"
|
|
streamHandler = logging.StreamHandler()
|
|
streamHandler.setFormatter(logging.Formatter(fmt))
|
|
if utils.TESTCONFIG.debug:
|
|
streamHandler.setLevel(logging.DEBUG)
|
|
log.setLevel(logging.DEBUG)
|
|
else:
|
|
streamHandler.setLevel(logging.ERROR)
|
|
log.setLevel(logging.ERROR)
|
|
log.addHandler(streamHandler)
|