mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
tests: Rename clistate -> TESTCONFIG
Makes it more clear it's a constant class, and its purpose Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
c01fbcc885
commit
61a947d667
@ -32,7 +32,7 @@ def setup_logging():
|
|||||||
fmt = "%(levelname)-8s %(message)s"
|
fmt = "%(levelname)-8s %(message)s"
|
||||||
streamHandler = logging.StreamHandler()
|
streamHandler = logging.StreamHandler()
|
||||||
streamHandler.setFormatter(logging.Formatter(fmt))
|
streamHandler.setFormatter(logging.Formatter(fmt))
|
||||||
if utils.clistate.debug:
|
if utils.TESTCONFIG.debug:
|
||||||
streamHandler.setLevel(logging.DEBUG)
|
streamHandler.setLevel(logging.DEBUG)
|
||||||
else:
|
else:
|
||||||
streamHandler.setLevel(logging.ERROR)
|
streamHandler.setLevel(logging.ERROR)
|
||||||
|
@ -80,13 +80,13 @@ def pytest_collection_modifyitems(config, items):
|
|||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
import tests
|
import tests
|
||||||
from tests.utils import clistate
|
from tests.utils import TESTCONFIG
|
||||||
|
|
||||||
clistate.url_iso_only = config.getoption("--urls-iso-only")
|
TESTCONFIG.url_iso_only = config.getoption("--urls-iso-only")
|
||||||
clistate.url_only = config.getoption("--urls-url-only")
|
TESTCONFIG.url_only = config.getoption("--urls-url-only")
|
||||||
clistate.url_skip_libosinfo = config.getoption("--urls-skip-libosinfo")
|
TESTCONFIG.url_skip_libosinfo = config.getoption("--urls-skip-libosinfo")
|
||||||
clistate.url_force_libosinfo = config.getoption("--urls-force-libosinfo")
|
TESTCONFIG.url_force_libosinfo = config.getoption("--urls-force-libosinfo")
|
||||||
clistate.regenerate_output = config.getoption("--regenerate-output")
|
TESTCONFIG.regenerate_output = config.getoption("--regenerate-output")
|
||||||
|
|
||||||
clistate.debug = config.getoption("--log-level") == "debug"
|
TESTCONFIG.debug = config.getoption("--log-level") == "debug"
|
||||||
tests.setup_logging()
|
tests.setup_logging()
|
||||||
|
@ -273,7 +273,7 @@ class Command(object):
|
|||||||
|
|
||||||
# Generate test files that don't exist yet
|
# Generate test files that don't exist yet
|
||||||
filename = self.compare_file
|
filename = self.compare_file
|
||||||
if (utils.clistate.regenerate_output or
|
if (utils.TESTCONFIG.regenerate_output or
|
||||||
not os.path.exists(filename)):
|
not os.path.exists(filename)):
|
||||||
open(filename, "w").write(output)
|
open(filename, "w").write(output)
|
||||||
|
|
||||||
|
@ -66,11 +66,11 @@ hvmguest.os.os_type = "hvm"
|
|||||||
xenguest = Guest(testconn)
|
xenguest = Guest(testconn)
|
||||||
xenguest.os.os_type = "xen"
|
xenguest.os.os_type = "xen"
|
||||||
|
|
||||||
meter = virtinst.progress.make_meter(quiet=not utils.clistate.debug)
|
meter = virtinst.progress.make_meter(quiet=not utils.TESTCONFIG.debug)
|
||||||
|
|
||||||
if utils.clistate.url_skip_libosinfo:
|
if utils.TESTCONFIG.url_skip_libosinfo:
|
||||||
os.environ["VIRTINST_TEST_SUITE_FORCE_LIBOSINFO"] = "0"
|
os.environ["VIRTINST_TEST_SUITE_FORCE_LIBOSINFO"] = "0"
|
||||||
elif utils.clistate.url_force_libosinfo:
|
elif utils.TESTCONFIG.url_force_libosinfo:
|
||||||
os.environ["VIRTINST_TEST_SUITE_FORCE_LIBOSINFO"] = "1"
|
os.environ["VIRTINST_TEST_SUITE_FORCE_LIBOSINFO"] = "1"
|
||||||
|
|
||||||
|
|
||||||
@ -84,12 +84,12 @@ def _skipmsg(testdata):
|
|||||||
is_iso = testdata.url.lower().endswith(".iso")
|
is_iso = testdata.url.lower().endswith(".iso")
|
||||||
distname = testdata.name
|
distname = testdata.name
|
||||||
|
|
||||||
if utils.clistate.url_iso_only and not is_iso:
|
if utils.TESTCONFIG.url_iso_only and not is_iso:
|
||||||
return "skipping non-iso test"
|
return "skipping non-iso test"
|
||||||
elif utils.clistate.url_only and is_iso:
|
elif utils.TESTCONFIG.url_only and is_iso:
|
||||||
return "skipping non-url test"
|
return "skipping non-url test"
|
||||||
|
|
||||||
if not utils.clistate.url_force_libosinfo:
|
if not utils.TESTCONFIG.url_force_libosinfo:
|
||||||
return
|
return
|
||||||
if testdata.skip_libosinfo:
|
if testdata.skip_libosinfo:
|
||||||
return "force-libosinfo requested but test has skip_libosinfo set"
|
return "force-libosinfo requested but test has skip_libosinfo set"
|
||||||
|
@ -458,7 +458,7 @@ class VMMDogtailApp(object):
|
|||||||
window_name=None, xmleditor_enabled=False):
|
window_name=None, xmleditor_enabled=False):
|
||||||
extra_opts = extra_opts or []
|
extra_opts = extra_opts or []
|
||||||
|
|
||||||
if tests.utils.clistate.debug:
|
if tests.utils.TESTCONFIG.debug:
|
||||||
stdout = sys.stdout
|
stdout = sys.stdout
|
||||||
stderr = sys.stderr
|
stderr = sys.stderr
|
||||||
extra_opts.append("--debug")
|
extra_opts.append("--debug")
|
||||||
|
@ -18,7 +18,7 @@ import virtinst.uri
|
|||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
# Access to protected member, needed to unittest stuff
|
# Access to protected member, needed to unittest stuff
|
||||||
|
|
||||||
class _CLIState(object):
|
class _TestConfig(object):
|
||||||
"""
|
"""
|
||||||
Class containing any bits passed in from setup.py
|
Class containing any bits passed in from setup.py
|
||||||
"""
|
"""
|
||||||
@ -32,7 +32,7 @@ class _CLIState(object):
|
|||||||
self.url_force_libosinfo = False
|
self.url_force_libosinfo = False
|
||||||
|
|
||||||
|
|
||||||
clistate = _CLIState()
|
TESTCONFIG = _TestConfig()
|
||||||
|
|
||||||
|
|
||||||
def has_old_osinfo():
|
def has_old_osinfo():
|
||||||
@ -212,7 +212,7 @@ def test_create(testconn, xml, define_func="defineXML"):
|
|||||||
def diff_compare(actual_out, filename=None, expect_out=None):
|
def diff_compare(actual_out, filename=None, expect_out=None):
|
||||||
"""Compare passed string output to contents of filename"""
|
"""Compare passed string output to contents of filename"""
|
||||||
if not expect_out:
|
if not expect_out:
|
||||||
if not os.path.exists(filename) or clistate.regenerate_output:
|
if not os.path.exists(filename) or TESTCONFIG.regenerate_output:
|
||||||
open(filename, "w").write(actual_out)
|
open(filename, "w").write(actual_out)
|
||||||
expect_out = open(filename).read()
|
expect_out = open(filename).read()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user