test/osbuild: use new list_modules_for_class

Convert our custom code to list modules to the new ModuleInfo
method list_modules_for_class that does the same thing. This
is then indeed also testing that new function.
This commit is contained in:
Christian Kellner 2020-05-28 16:13:20 +02:00 committed by David Rheinsberg
parent dd00c4f478
commit 131d0264a8

View file

@ -78,11 +78,14 @@ class TestDescriptions(unittest.TestCase):
})
def test_moduleinfo(self):
def list_modules(base, klass):
return [(klass, f) for f in os.listdir(base) if f.startswith("org.osbuild")]
index = osbuild.meta.Index(os.curdir)
modules = list_modules("stages", "Stage")
modules += list_modules("assemblers", "Assembler")
modules = []
for klass in ("Stage", "Assembler"):
mods = index.list_modules_for_class(klass)
modules += [(klass, module) for module in mods]
self.assertTrue(modules)
for module in modules:
klass, name = module