tests: Move OLD_OSINFO check to central place

Other tests may need it in the future
This commit is contained in:
Cole Robinson 2018-10-04 19:18:27 -04:00
parent 9edca3486a
commit 877cbade4a
2 changed files with 10 additions and 5 deletions

View File

@ -14,7 +14,6 @@ import sys
import traceback
import unittest
import virtinst
from tests import virtinstall, virtclone, virtconvert, virtxml
from tests import utils
@ -22,10 +21,7 @@ os.environ["LANG"] = "en_US.UTF-8"
os.environ["HOME"] = "/tmp"
os.environ["DISPLAY"] = ":3.4"
OLD_OSINFO = False
if virtinst.OSDB.lookup_os("rhel7.0"):
OLD_OSINFO = not virtinst.OSDB.lookup_os("rhel7.0").supports_usb3()
OLD_OSINFO = utils.has_old_osinfo()
TMP_IMAGE_DIR = "/tmp/__virtinst_cli_"
XMLDIR = "tests/cli-test-xml"

View File

@ -29,6 +29,15 @@ class _CLIState(object):
clistate = _CLIState()
def has_old_osinfo():
# Some tests rely on newer osinfo data. Check for a new condition
# here, and older tests will be skipped
osname = "rhel7.0"
if not virtinst.OSDB.lookup_os(osname):
return True
return not virtinst.OSDB.lookup_os(osname).supports_usb3()
class _URIs(object):
def __init__(self):
self._conn_cache = {}