XXX: This is hacky but we'd like to validate the methods in plugin_impl at least has all the *abstract* methods in plugin_base_class.
(plugin_base_class, plugin_klass)
| 105 | |
| 106 | |
| 107 | def _validate_methods(plugin_base_class, plugin_klass): |
| 108 | """ |
| 109 | XXX: This is hacky but we'd like to validate the methods |
| 110 | in plugin_impl at least has all the *abstract* methods in |
| 111 | plugin_base_class. |
| 112 | """ |
| 113 | expected_methods = plugin_base_class.__abstractmethods__ |
| 114 | plugin_methods = _get_plugin_methods(plugin_klass) |
| 115 | for method in expected_methods: |
| 116 | if method not in plugin_methods: |
| 117 | message = ( |
| 118 | 'Class "%s" doesn\'t implement required "%s" method from the base class' |
| 119 | ) |
| 120 | raise IncompatiblePluginException(message % (plugin_klass.__name__, method)) |
| 121 | |
| 122 | |
| 123 | def _register_plugin(plugin_base_class, plugin_impl): |
no test coverage detected