From 2f8bc32c147775a2efbd98384395af62aece04b5 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Wed, 24 Apr 2013 23:39:14 +0200 Subject: [PATCH] config: Remove ExtensionConfigSchema --- mopidy/config/schemas.py | 12 ------------ mopidy/ext.py | 4 +++- tests/config/schemas_test.py | 6 ------ tests/ext_test.py | 1 - 4 files changed, 3 insertions(+), 20 deletions(-) diff --git a/mopidy/config/schemas.py b/mopidy/config/schemas.py index ba91161c..7364530f 100644 --- a/mopidy/config/schemas.py +++ b/mopidy/config/schemas.py @@ -98,18 +98,6 @@ class ConfigSchema(object): return result -class ExtensionConfigSchema(ConfigSchema): - """Sub-classed :class:`ConfigSchema` for use in extensions. - - Ensures that ``enabled`` config value is present. - """ - def __init__(self, name): - super(ExtensionConfigSchema, self).__init__(name) - self['enabled'] = types.Boolean() - - # TODO: override serialize to gate on enabled=true? - - class LogLevelConfigSchema(object): """Special cased schema for handling a config section with loglevels. diff --git a/mopidy/ext.py b/mopidy/ext.py index 27e72854..64a71256 100644 --- a/mopidy/ext.py +++ b/mopidy/ext.py @@ -46,7 +46,9 @@ class Extension(object): :returns: :class:`~mopidy.config.schema.ExtensionConfigSchema` """ - return config_lib.ExtensionConfigSchema(self.ext_name) + schema = config_lib.ConfigSchema(self.ext_name) + schema['enabled'] = config_lib.Boolean() + return schema def validate_environment(self): """Checks if the extension can run in the current environment diff --git a/tests/config/schemas_test.py b/tests/config/schemas_test.py index a0c519f4..1595b508 100644 --- a/tests/config/schemas_test.py +++ b/tests/config/schemas_test.py @@ -77,12 +77,6 @@ class ConfigSchemaTest(unittest.TestCase): self.assertIsNone(result['baz']) -class ExtensionConfigSchemaTest(unittest.TestCase): - def test_schema_includes_enabled(self): - schema = schemas.ExtensionConfigSchema('test') - self.assertIsInstance(schema['enabled'], types.Boolean) - - class LogLevelConfigSchemaTest(unittest.TestCase): def test_conversion(self): schema = schemas.LogLevelConfigSchema('test') diff --git a/tests/ext_test.py b/tests/ext_test.py index 04f52866..7bbe5cc4 100644 --- a/tests/ext_test.py +++ b/tests/ext_test.py @@ -23,7 +23,6 @@ class ExtensionTest(unittest.TestCase): def test_get_config_schema_returns_extension_schema(self): schema = self.ext.get_config_schema() - self.assertIsInstance(schema, config.ExtensionConfigSchema) self.assertIsInstance(schema['enabled'], config.Boolean) def test_validate_environment_does_nothing_by_default(self):