From e4ae9ec01826d2fd8a1887b2848fc134e1cbb16b Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 12 Jun 2023 16:09:54 -0700 Subject: [PATCH] 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. --- test/mod/test_osbuild.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/mod/test_osbuild.py b/test/mod/test_osbuild.py index f47ed99e..f502d238 100644 --- a/test/mod/test_osbuild.py +++ b/test/mod/test_osbuild.py @@ -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"]: