From 807470557d7e43e1081e03644d98c9dd1ec6e508 Mon Sep 17 00:00:00 2001 From: Gabriel Selzer Date: Tue, 5 Apr 2022 09:32:45 -0500 Subject: [PATCH 01/11] Add configuration field to manifest --- npe2/manifest/schema.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/npe2/manifest/schema.py b/npe2/manifest/schema.py index 663d29f8..22cf81e9 100644 --- a/npe2/manifest/schema.py +++ b/npe2/manifest/schema.py @@ -6,7 +6,7 @@ from logging import getLogger from pathlib import Path from textwrap import dedent -from typing import Iterator, NamedTuple, Optional, Sequence, Union +from typing import Any, Dict, Iterator, List, NamedTuple, Optional, Sequence, Union from pydantic import Extra, Field, ValidationError, root_validator, validator from pydantic.error_wrappers import ErrorWrapper @@ -126,6 +126,13 @@ class Config: exclude=True, ) + configuration: Optional[Dict[str, Any]] = Field( + default={}, + description="Configuration for global values." + "May be appended to by other plugins" + "who wish to have a say in shared state", + ) + def __init__(self, **data): super().__init__(**data) if self.package_metadata is None and self.name: @@ -158,6 +165,10 @@ def author(self) -> Optional[str]: def _coerce_none_contributions(cls, value): return [] if value is None else value + @validator("configuration", pre=True) + def _coerce_none_configuration(cls, value): + return {} if value is None else value + @root_validator def _validate_root(cls, values: dict) -> dict: # validate schema version From c88ec8a6a8aa130eb952e11b559f44499f5e7bbd Mon Sep 17 00:00:00 2001 From: Gabriel Selzer Date: Tue, 5 Apr 2022 10:23:54 -0500 Subject: [PATCH 02/11] Add API for accessing configuration --- npe2/_plugin_manager.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/npe2/_plugin_manager.py b/npe2/_plugin_manager.py index 946a5dd0..829907b9 100644 --- a/npe2/_plugin_manager.py +++ b/npe2/_plugin_manager.py @@ -531,6 +531,34 @@ def get_writer( # Nothing got found return None, path + # Accessing Contributions + + def configuration(self, config_key: str) -> List[Any]: + """ + Get plugin configuration specifications for the provided key + + Configurations are NOT merged until this method is called, and the state is + not saved. This lazy configuration discovery is preferrable as it ensures + that the returned list is consistent with the list of registered plugins. + + Parameters + ---------- + config_key : str + Key specified by plugin(s) + + Returns + ------- + List[Any] + All values specified by all plugins for key config_key + """ + + configuration_values = [] + # Search all manifests for the presence of config key + declaring_manifests = filter(lambda m: config_key in m.configuration, self._manifests) + for manifest in declaring_manifests: + configuration_values.append(manifest.configuration[config_key]) + + return configuration_values class PluginContext: """An object that can contain information for a plugin over its lifetime.""" From 66f627f1271081b904061a19beb419874fa77737 Mon Sep 17 00:00:00 2001 From: Gabriel Selzer Date: Tue, 5 Apr 2022 12:30:21 -0500 Subject: [PATCH 03/11] Develop configuration via TDD --- npe2/_plugin_manager.py | 14 +++++---- tests/sample/my_plugin/napari.yaml | 12 ++++++++ tests/test_configuration.py | 46 ++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 tests/test_configuration.py diff --git a/npe2/_plugin_manager.py b/npe2/_plugin_manager.py index 829907b9..a487620c 100644 --- a/npe2/_plugin_manager.py +++ b/npe2/_plugin_manager.py @@ -533,7 +533,7 @@ def get_writer( # Accessing Contributions - def configuration(self, config_key: str) -> List[Any]: + def configuration(self, config_key: str) -> Set[Any]: """ Get plugin configuration specifications for the provided key @@ -548,15 +548,19 @@ def configuration(self, config_key: str) -> List[Any]: Returns ------- - List[Any] + Set[Any] All values specified by all plugins for key config_key """ - configuration_values = [] + configuration_values = set() # Search all manifests for the presence of config key - declaring_manifests = filter(lambda m: config_key in m.configuration, self._manifests) + declaring_manifests = filter(lambda m: config_key in m.configuration, self._manifests.values()) for manifest in declaring_manifests: - configuration_values.append(manifest.configuration[config_key]) + value = manifest.configuration[config_key] + if isinstance(value, Iterable) and not isinstance(value, str): + configuration_values.update(value) + else: + configuration_values.add(value) return configuration_values diff --git a/tests/sample/my_plugin/napari.yaml b/tests/sample/my_plugin/napari.yaml index 9a6bc15f..e927b742 100644 --- a/tests/sample/my_plugin/napari.yaml +++ b/tests/sample/my_plugin/napari.yaml @@ -91,3 +91,15 @@ contributions: - display_name: Random internet image key: internet_image uri: https://picsum.photos/1024 +configuration: + check_num: 10 + check_num_list: + - 1 + - 2 + - 3 + check_str: 'foo' + check_str_list: + - 'a' + - 'b' + - 'c' + check_bool: true \ No newline at end of file diff --git a/tests/test_configuration.py b/tests/test_configuration.py new file mode 100644 index 00000000..00a509fe --- /dev/null +++ b/tests/test_configuration.py @@ -0,0 +1,46 @@ +from npe2 import PluginManager +from npe2.manifest.schema import PluginManifest + +SAMPLE_PLUGIN_NAME = "my-plugin" + +def test_configuration_empty(): + """ Ensures unpopulated configuration before plugin discovery. """ + pm = PluginManager() + assert pm.configuration('check_str') == set() + +def test_configuration_single_plugin(sample_manifest): + """ Ensures populated configuration after plugin registry. """ + pm = PluginManager() + pm.register(sample_manifest) + assert pm.configuration('check_str') == {'foo'} + assert pm.configuration('check_str_list') == {'a', 'b', 'c'} + assert pm.configuration('check_num') == {10} + assert pm.configuration('check_num_list') == {1, 2, 3} + assert pm.configuration('check_bool') == {True} + +def test_configuration_single_plugin_unregister(sample_manifest): + """ Ensures unpopulated configuration after plugin unregistry. """ + pm = PluginManager() + pm.register(sample_manifest) + pm.unregister('my-plugin') + assert pm.configuration('check_str') == set() + +def test_configuration_multiple_plugins(sample_manifest): + """ Ensures population for multiple plugins """ + pm = PluginManager() + + # Add a plugin + pm.register(sample_manifest) + assert pm.configuration('check_str') == {'foo'} + + # Add a second plugin + manifest2 = PluginManifest(name = 'my-second-plugin', configuration={'check_str': 'bar'}) + pm.register(manifest2) + # Ensure its configuration is appended + assert pm.configuration('check_str') == {'foo', 'bar'} + + # Add a third plugin + manifest3 = PluginManifest(name = 'my-third-plugin', configuration={'check_str': 'foo'}) + pm.register(manifest3) + # Ensure its configuration is merged + assert pm.configuration('check_str') == {'foo', 'bar'} \ No newline at end of file From c4a9479232dddb29ae73d66d21641be91c21a286 Mon Sep 17 00:00:00 2001 From: Gabriel Selzer Date: Tue, 5 Apr 2022 12:36:32 -0500 Subject: [PATCH 04/11] Rename configuration to properties This prevents collision with Talley's configuration :) --- npe2/_plugin_manager.py | 20 +++++++------- npe2/manifest/schema.py | 8 +++--- tests/sample/my_plugin/napari.yaml | 2 +- tests/test_configuration.py | 44 +++++++++++++++--------------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/npe2/_plugin_manager.py b/npe2/_plugin_manager.py index a487620c..10961067 100644 --- a/npe2/_plugin_manager.py +++ b/npe2/_plugin_manager.py @@ -533,12 +533,12 @@ def get_writer( # Accessing Contributions - def configuration(self, config_key: str) -> Set[Any]: + def properties(self, config_key: str) -> Set[Any]: """ - Get plugin configuration specifications for the provided key + Get plugin properties specifications for the provided key - Configurations are NOT merged until this method is called, and the state is - not saved. This lazy configuration discovery is preferrable as it ensures + Properties are NOT merged until this method is called, and the state is + not saved. This lazy properties discovery is preferrable as it ensures that the returned list is consistent with the list of registered plugins. Parameters @@ -552,17 +552,17 @@ def configuration(self, config_key: str) -> Set[Any]: All values specified by all plugins for key config_key """ - configuration_values = set() + properties_values = set() # Search all manifests for the presence of config key - declaring_manifests = filter(lambda m: config_key in m.configuration, self._manifests.values()) + declaring_manifests = filter(lambda m: config_key in m.properties, self._manifests.values()) for manifest in declaring_manifests: - value = manifest.configuration[config_key] + value = manifest.properties[config_key] if isinstance(value, Iterable) and not isinstance(value, str): - configuration_values.update(value) + properties_values.update(value) else: - configuration_values.add(value) + properties_values.add(value) - return configuration_values + return properties_values class PluginContext: """An object that can contain information for a plugin over its lifetime.""" diff --git a/npe2/manifest/schema.py b/npe2/manifest/schema.py index 22cf81e9..61b5b6a8 100644 --- a/npe2/manifest/schema.py +++ b/npe2/manifest/schema.py @@ -126,9 +126,9 @@ class Config: exclude=True, ) - configuration: Optional[Dict[str, Any]] = Field( + properties: Optional[Dict[str, Any]] = Field( default={}, - description="Configuration for global values." + description="Properties for global values." "May be appended to by other plugins" "who wish to have a say in shared state", ) @@ -165,8 +165,8 @@ def author(self) -> Optional[str]: def _coerce_none_contributions(cls, value): return [] if value is None else value - @validator("configuration", pre=True) - def _coerce_none_configuration(cls, value): + @validator("properties", pre=True) + def _coerce_none_properties(cls, value): return {} if value is None else value @root_validator diff --git a/tests/sample/my_plugin/napari.yaml b/tests/sample/my_plugin/napari.yaml index e927b742..631bd1dc 100644 --- a/tests/sample/my_plugin/napari.yaml +++ b/tests/sample/my_plugin/napari.yaml @@ -91,7 +91,7 @@ contributions: - display_name: Random internet image key: internet_image uri: https://picsum.photos/1024 -configuration: +properties: check_num: 10 check_num_list: - 1 diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 00a509fe..059bec24 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -3,44 +3,44 @@ SAMPLE_PLUGIN_NAME = "my-plugin" -def test_configuration_empty(): - """ Ensures unpopulated configuration before plugin discovery. """ +def test_properties_empty(): + """ Ensures unpopulated properties before plugin discovery. """ pm = PluginManager() - assert pm.configuration('check_str') == set() + assert pm.properties('check_str') == set() -def test_configuration_single_plugin(sample_manifest): - """ Ensures populated configuration after plugin registry. """ +def test_properties_single_plugin(sample_manifest): + """ Ensures populated properties after plugin registry. """ pm = PluginManager() pm.register(sample_manifest) - assert pm.configuration('check_str') == {'foo'} - assert pm.configuration('check_str_list') == {'a', 'b', 'c'} - assert pm.configuration('check_num') == {10} - assert pm.configuration('check_num_list') == {1, 2, 3} - assert pm.configuration('check_bool') == {True} - -def test_configuration_single_plugin_unregister(sample_manifest): - """ Ensures unpopulated configuration after plugin unregistry. """ + assert pm.properties('check_str') == {'foo'} + assert pm.properties('check_str_list') == {'a', 'b', 'c'} + assert pm.properties('check_num') == {10} + assert pm.properties('check_num_list') == {1, 2, 3} + assert pm.properties('check_bool') == {True} + +def test_properties_single_plugin_unregister(sample_manifest): + """ Ensures unpopulated properties after plugin unregistry. """ pm = PluginManager() pm.register(sample_manifest) pm.unregister('my-plugin') - assert pm.configuration('check_str') == set() + assert pm.properties('check_str') == set() -def test_configuration_multiple_plugins(sample_manifest): +def test_properties_multiple_plugins(sample_manifest): """ Ensures population for multiple plugins """ pm = PluginManager() # Add a plugin pm.register(sample_manifest) - assert pm.configuration('check_str') == {'foo'} + assert pm.properties('check_str') == {'foo'} # Add a second plugin - manifest2 = PluginManifest(name = 'my-second-plugin', configuration={'check_str': 'bar'}) + manifest2 = PluginManifest(name = 'my-second-plugin', properties={'check_str': 'bar'}) pm.register(manifest2) - # Ensure its configuration is appended - assert pm.configuration('check_str') == {'foo', 'bar'} + # Ensure its properties is appended + assert pm.properties('check_str') == {'foo', 'bar'} # Add a third plugin - manifest3 = PluginManifest(name = 'my-third-plugin', configuration={'check_str': 'foo'}) + manifest3 = PluginManifest(name = 'my-third-plugin', properties={'check_str': 'foo'}) pm.register(manifest3) - # Ensure its configuration is merged - assert pm.configuration('check_str') == {'foo', 'bar'} \ No newline at end of file + # Ensure its properties is merged + assert pm.properties('check_str') == {'foo', 'bar'} \ No newline at end of file From e5f8ad46d5455b589ce46675091c1fa6ebf3be79 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 5 Apr 2022 17:57:50 +0000 Subject: [PATCH 05/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- npe2/_plugin_manager.py | 5 +++- npe2/manifest/schema.py | 2 +- tests/sample/my_plugin/napari.yaml | 2 +- tests/test_configuration.py | 38 +++++++++++++++++------------- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/npe2/_plugin_manager.py b/npe2/_plugin_manager.py index 10961067..0b47fca5 100644 --- a/npe2/_plugin_manager.py +++ b/npe2/_plugin_manager.py @@ -554,7 +554,9 @@ def properties(self, config_key: str) -> Set[Any]: properties_values = set() # Search all manifests for the presence of config key - declaring_manifests = filter(lambda m: config_key in m.properties, self._manifests.values()) + declaring_manifests = filter( + lambda m: config_key in m.properties, self._manifests.values() + ) for manifest in declaring_manifests: value = manifest.properties[config_key] if isinstance(value, Iterable) and not isinstance(value, str): @@ -564,6 +566,7 @@ def properties(self, config_key: str) -> Set[Any]: return properties_values + class PluginContext: """An object that can contain information for a plugin over its lifetime.""" diff --git a/npe2/manifest/schema.py b/npe2/manifest/schema.py index 61b5b6a8..660385e0 100644 --- a/npe2/manifest/schema.py +++ b/npe2/manifest/schema.py @@ -6,7 +6,7 @@ from logging import getLogger from pathlib import Path from textwrap import dedent -from typing import Any, Dict, Iterator, List, NamedTuple, Optional, Sequence, Union +from typing import Any, Dict, Iterator, NamedTuple, Optional, Sequence, Union from pydantic import Extra, Field, ValidationError, root_validator, validator from pydantic.error_wrappers import ErrorWrapper diff --git a/tests/sample/my_plugin/napari.yaml b/tests/sample/my_plugin/napari.yaml index 631bd1dc..7b764c6f 100644 --- a/tests/sample/my_plugin/napari.yaml +++ b/tests/sample/my_plugin/napari.yaml @@ -102,4 +102,4 @@ properties: - 'a' - 'b' - 'c' - check_bool: true \ No newline at end of file + check_bool: true diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 059bec24..f8e69941 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -3,44 +3,48 @@ SAMPLE_PLUGIN_NAME = "my-plugin" + def test_properties_empty(): - """ Ensures unpopulated properties before plugin discovery. """ + """Ensures unpopulated properties before plugin discovery.""" pm = PluginManager() - assert pm.properties('check_str') == set() + assert pm.properties("check_str") == set() + def test_properties_single_plugin(sample_manifest): - """ Ensures populated properties after plugin registry. """ + """Ensures populated properties after plugin registry.""" pm = PluginManager() pm.register(sample_manifest) - assert pm.properties('check_str') == {'foo'} - assert pm.properties('check_str_list') == {'a', 'b', 'c'} - assert pm.properties('check_num') == {10} - assert pm.properties('check_num_list') == {1, 2, 3} - assert pm.properties('check_bool') == {True} + assert pm.properties("check_str") == {"foo"} + assert pm.properties("check_str_list") == {"a", "b", "c"} + assert pm.properties("check_num") == {10} + assert pm.properties("check_num_list") == {1, 2, 3} + assert pm.properties("check_bool") == {True} + def test_properties_single_plugin_unregister(sample_manifest): - """ Ensures unpopulated properties after plugin unregistry. """ + """Ensures unpopulated properties after plugin unregistry.""" pm = PluginManager() pm.register(sample_manifest) - pm.unregister('my-plugin') - assert pm.properties('check_str') == set() + pm.unregister("my-plugin") + assert pm.properties("check_str") == set() + def test_properties_multiple_plugins(sample_manifest): - """ Ensures population for multiple plugins """ + """Ensures population for multiple plugins""" pm = PluginManager() # Add a plugin pm.register(sample_manifest) - assert pm.properties('check_str') == {'foo'} + assert pm.properties("check_str") == {"foo"} # Add a second plugin - manifest2 = PluginManifest(name = 'my-second-plugin', properties={'check_str': 'bar'}) + manifest2 = PluginManifest(name="my-second-plugin", properties={"check_str": "bar"}) pm.register(manifest2) # Ensure its properties is appended - assert pm.properties('check_str') == {'foo', 'bar'} + assert pm.properties("check_str") == {"foo", "bar"} # Add a third plugin - manifest3 = PluginManifest(name = 'my-third-plugin', properties={'check_str': 'foo'}) + manifest3 = PluginManifest(name="my-third-plugin", properties={"check_str": "foo"}) pm.register(manifest3) # Ensure its properties is merged - assert pm.properties('check_str') == {'foo', 'bar'} \ No newline at end of file + assert pm.properties("check_str") == {"foo", "bar"} From cab09484785792d61f2bcda72393da032a2d90ea Mon Sep 17 00:00:00 2001 From: Gabriel Selzer Date: Tue, 5 Apr 2022 13:11:25 -0500 Subject: [PATCH 06/11] Add type hint for set --- npe2/_plugin_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npe2/_plugin_manager.py b/npe2/_plugin_manager.py index 0b47fca5..0442fce2 100644 --- a/npe2/_plugin_manager.py +++ b/npe2/_plugin_manager.py @@ -552,7 +552,7 @@ def properties(self, config_key: str) -> Set[Any]: All values specified by all plugins for key config_key """ - properties_values = set() + properties_values: Set[Any] = set() # Search all manifests for the presence of config key declaring_manifests = filter( lambda m: config_key in m.properties, self._manifests.values() From 16d00b3247e8677e242a8bdc5a38702b92d78f6b Mon Sep 17 00:00:00 2001 From: Gabriel Selzer Date: Tue, 5 Apr 2022 13:26:45 -0500 Subject: [PATCH 07/11] Placate mypy - check for manifest.properties --- npe2/_plugin_manager.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/npe2/_plugin_manager.py b/npe2/_plugin_manager.py index 0442fce2..5c13cbaf 100644 --- a/npe2/_plugin_manager.py +++ b/npe2/_plugin_manager.py @@ -554,10 +554,9 @@ def properties(self, config_key: str) -> Set[Any]: properties_values: Set[Any] = set() # Search all manifests for the presence of config key - declaring_manifests = filter( - lambda m: config_key in m.properties, self._manifests.values() - ) - for manifest in declaring_manifests: + for manifest in self._manifests.values(): + if manifest.properties is None: continue + if config_key not in manifest.properties: continue value = manifest.properties[config_key] if isinstance(value, Iterable) and not isinstance(value, str): properties_values.update(value) From d046cc138c8e4bcadd70251e2c5ec9a7cb183bee Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 5 Apr 2022 18:28:46 +0000 Subject: [PATCH 08/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- npe2/_plugin_manager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/npe2/_plugin_manager.py b/npe2/_plugin_manager.py index 5c13cbaf..04214506 100644 --- a/npe2/_plugin_manager.py +++ b/npe2/_plugin_manager.py @@ -555,8 +555,10 @@ def properties(self, config_key: str) -> Set[Any]: properties_values: Set[Any] = set() # Search all manifests for the presence of config key for manifest in self._manifests.values(): - if manifest.properties is None: continue - if config_key not in manifest.properties: continue + if manifest.properties is None: + continue + if config_key not in manifest.properties: + continue value = manifest.properties[config_key] if isinstance(value, Iterable) and not isinstance(value, str): properties_values.update(value) From 2549cacf8f61e28b8c318320ed5d8e40c943ec61 Mon Sep 17 00:00:00 2001 From: Gabriel Selzer Date: Tue, 5 Apr 2022 14:04:10 -0500 Subject: [PATCH 09/11] Test a property not in a valid properties map --- tests/test_configuration.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_configuration.py b/tests/test_configuration.py index f8e69941..3cd17962 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -48,3 +48,18 @@ def test_properties_multiple_plugins(sample_manifest): pm.register(manifest3) # Ensure its properties is merged assert pm.properties("check_str") == {"foo", "bar"} + +def test_properties_not_added(sample_manifest): + """Ensures unpopulation for unused property""" + pm = PluginManager() + + # Add a plugin + pm.register(sample_manifest) + assert pm.properties("not_added") == set() + + # Add a third plugin + manifest2 = PluginManifest(name="my-third-plugin") + pm.register(manifest2) + assert pm.properties("not_added") == set() + + From 05c57c4a1717d5c3a01204332eae29018703c1bb Mon Sep 17 00:00:00 2001 From: Gabriel Selzer Date: Tue, 5 Apr 2022 14:04:28 -0500 Subject: [PATCH 10/11] Remove validator I don't think we need it because we have a default (empty) map --- npe2/_plugin_manager.py | 2 -- npe2/manifest/schema.py | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/npe2/_plugin_manager.py b/npe2/_plugin_manager.py index 04214506..baa9603f 100644 --- a/npe2/_plugin_manager.py +++ b/npe2/_plugin_manager.py @@ -555,8 +555,6 @@ def properties(self, config_key: str) -> Set[Any]: properties_values: Set[Any] = set() # Search all manifests for the presence of config key for manifest in self._manifests.values(): - if manifest.properties is None: - continue if config_key not in manifest.properties: continue value = manifest.properties[config_key] diff --git a/npe2/manifest/schema.py b/npe2/manifest/schema.py index 660385e0..597f18a4 100644 --- a/npe2/manifest/schema.py +++ b/npe2/manifest/schema.py @@ -126,7 +126,7 @@ class Config: exclude=True, ) - properties: Optional[Dict[str, Any]] = Field( + properties: Dict[str, Any] = Field( default={}, description="Properties for global values." "May be appended to by other plugins" @@ -165,10 +165,6 @@ def author(self) -> Optional[str]: def _coerce_none_contributions(cls, value): return [] if value is None else value - @validator("properties", pre=True) - def _coerce_none_properties(cls, value): - return {} if value is None else value - @root_validator def _validate_root(cls, values: dict) -> dict: # validate schema version From 50de39dc68f3a49a8c33b4cd5447fb1c28b234f5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 5 Apr 2022 19:15:18 +0000 Subject: [PATCH 11/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_configuration.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 3cd17962..4aac6220 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -49,11 +49,12 @@ def test_properties_multiple_plugins(sample_manifest): # Ensure its properties is merged assert pm.properties("check_str") == {"foo", "bar"} + def test_properties_not_added(sample_manifest): """Ensures unpopulation for unused property""" pm = PluginManager() - # Add a plugin + # Add a plugin pm.register(sample_manifest) assert pm.properties("not_added") == set() @@ -61,5 +62,3 @@ def test_properties_not_added(sample_manifest): manifest2 = PluginManifest(name="my-third-plugin") pm.register(manifest2) assert pm.properties("not_added") == set() - -