Lines Matching refs:_registry
70 self._registry = plugins.Registry(
74 self.assertIsNotNone(self._registry.register('a_plugin',
76 self.assertIs(self._registry['a_plugin'].target, _no_docstring)
80 self._registry.register_by_name('plugin_one', __name__,
83 self._registry.register('plugin_two', _no_docstring))
85 self.assertIs(self._registry['plugin_one'].target, _no_docstring)
86 self.assertIs(self._registry['plugin_two'].target, _no_docstring)
90 self._registry.register_by_name('plugin_two', 'not a module',
95 self._registry.register_by_name('plugin_two', __name__, 'nothing')
99 self._registry.register('plugin_two', 'not function')
106 self.assertIsNotNone(self._registry.register('go', stash_argv))
109 self.assertEqual(self._registry.run_with_argv('go', ['1', '2']), 1)
114 self._registry.run_with_argv('plugin_one', [])
117 self.assertIsNotNone(self._registry.register('foo', lambda: None))
119 self._registry.register_by_name('bar', __name__, '_no_docstring'))
122 self._registry.register('foo', lambda: None)
125 self._registry.register('bar', lambda: None)
130 self._registry.register_directory(paths[1].parent, 'TEST_PLUGINS')
132 self.assertEqual(self._registry.run_with_argv('test_plugin', []), 123)
137 self._registry.register_directory(paths[0].parent, 'TEST_PLUGINS')
139 self.assertEqual(self._registry.run_with_argv('test_plugin', []), 456)
144 self._registry.register_directory(paths[0].parent, 'TEST_PLUGINS',
147 self.assertNotIn('other_plugin', self._registry)
152 self._registry.register_file(paths[0])
153 self._registry.register_file(paths[0])
154 self._registry.register_file(paths[0])
156 self.assertIs(self._registry['test_plugin'].target, _with_docstring)
159 self.assertIsNotNone(self._registry.register('a', _no_docstring))
160 self.assertIsNotNone(self._registry.register('b', _with_docstring))
162 self.assertIn(__doc__, '\n'.join(self._registry.detailed_help(['a'])))
165 '\n'.join(self._registry.detailed_help(['b'])))
167 '\n'.join(self._registry.detailed_help(['b'])))
180 self.assertIsNotNone(self._registry.register('a', function))
182 self.assertEqual(self._registry['a'].help(full=False), '')
183 self.assertEqual(self._registry['a'].help(full=True), '')
188 @self._registry.plugin
192 self.assertEqual(self._registry['nifty'].target, nifty)
195 @self._registry.plugin()
199 self.assertEqual(self._registry['nifty'].target, nifty)
202 @self._registry.plugin(name='nifty')
206 self.assertEqual(self._registry['nifty'].target, my_nifty_keen_plugin)