def test_find_plugins(self): self.maxDiff = None with open(os.path.join(self.tdir, 'foo.py'), 'w') as f: f.write(""" from openmdao.main.api import Component, Container class MyComp(Component): pass class MyCont(Container): pass """) expected = { 'openmdao.component': set(['foo.MyComp', 'openmdao.main.component.Component']), 'openmdao.container': set([ 'foo.MyCont', 'foo.MyComp', 'openmdao.main.component.Component', 'openmdao.main.container.Container' ]), } plugins = find_all_plugins(self.tdir) self.assertEqual(sorted(expected.keys()), sorted(plugins.keys())) for key, value in expected.items(): self.assertEqual(plugins[key], value)
def test_find_plugins(self): self.maxDiff = None with open(os.path.join(self.tdir, 'foo.py'), 'w') as f: f.write(""" from openmdao.main.api import Component, Container class MyComp(Component): pass class MyCont(Container): pass """) expected = { 'openmdao.component': set(['foo.MyComp', 'openmdao.main.component.Component']), 'openmdao.container': set(['foo.MyCont', 'foo.MyComp', 'openmdao.main.component.Component', 'openmdao.main.container.Container']), } plugins = find_all_plugins(self.tdir) self.assertEqual(expected.keys(), plugins.keys()) self.assertEqual(expected.values(), plugins.values())