Fail early if extension doesn't implement setup()

Fixes #813
This commit is contained in:
Stein Magnus Jodal 2014-08-03 23:13:12 +02:00
parent 2d4b447d0a
commit 837fb00fb7
3 changed files with 11 additions and 2 deletions

View File

@ -20,6 +20,10 @@ Bug fix release.
- Zeroconf: Fix intermittent DBus/Avahi exception.
- Extensions: Fail early if trying to setup an extension which doesn't
implement the :meth:`mopidy.ext.Extension.setup` method. (Fixes:
:issue:`813`)
v0.19.2 (2014-07-26)
====================

View File

@ -99,7 +99,7 @@ class Extension(object):
:param registry: the extension registry
:type registry: :class:`Registry`
"""
pass
raise NotImplementedError
class Registry(collections.Mapping):

View File

@ -19,7 +19,8 @@ class ExtensionTest(unittest.TestCase):
self.assertIsNone(self.ext.version)
def test_get_default_config_raises_not_implemented(self):
self.assertRaises(NotImplementedError, self.ext.get_default_config)
with self.assertRaises(NotImplementedError):
self.ext.get_default_config()
def test_get_config_schema_returns_extension_schema(self):
schema = self.ext.get_config_schema()
@ -27,3 +28,7 @@ class ExtensionTest(unittest.TestCase):
def test_validate_environment_does_nothing_by_default(self):
self.assertIsNone(self.ext.validate_environment())
def test_setup_raises_not_implemented(self):
with self.assertRaises(NotImplementedError):
self.ext.setup(None)