test: Skip check_moduleinfo for unsupported versions
Most modules do not support both schema versions. This is masked by module type code in get_schema() in most cases, but really should not be tested. This skips running check_moduleinfo if the module doesn't support the version. eg. org.osbuild.librepo only supports v2.
This commit is contained in:
parent
0eb842e80c
commit
e4ae9ec018
1 changed files with 8 additions and 0 deletions
|
|
@ -282,6 +282,10 @@ class TestDescriptions(unittest.TestCase):
|
|||
|
||||
try:
|
||||
info = osbuild.meta.ModuleInfo.load(os.curdir, klass, name)
|
||||
if not info.opts[version]:
|
||||
print(f"{klass} '{name}' does not support version '{version}'")
|
||||
continue
|
||||
|
||||
schema = osbuild.meta.Schema(info.get_schema(version), name)
|
||||
res = schema.check()
|
||||
if not res:
|
||||
|
|
@ -291,6 +295,10 @@ class TestDescriptions(unittest.TestCase):
|
|||
except json.decoder.JSONDecodeError as e:
|
||||
msg = f"{klass} '{name}' has invalid STAGE_OPTS\n\t" + str(e)
|
||||
self.fail(msg)
|
||||
# pylint: disable=broad-exception-caught
|
||||
except Exception as e:
|
||||
msg = f"{klass} '{name}': " + str(e)
|
||||
self.fail(msg)
|
||||
|
||||
def test_moduleinfo(self):
|
||||
for version in ["1", "2"]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue