diff --git a/changelog.d/20230316_113639_regis_fix_yaml_patch_ordering.md b/changelog.d/20230316_113639_regis_fix_yaml_patch_ordering.md new file mode 100644 index 0000000..f3459e3 --- /dev/null +++ b/changelog.d/20230316_113639_regis_fix_yaml_patch_ordering.md @@ -0,0 +1 @@ +- [Bugfix] Make sure that v0 plugin patches are applied in the same order as plugins are listed. (by @regisb) diff --git a/tests/test_plugins_v0.py b/tests/test_plugins_v0.py index 176e903..d343087 100644 --- a/tests/test_plugins_v0.py +++ b/tests/test_plugins_v0.py @@ -86,7 +86,7 @@ class PluginsTests(PluginsTestCase): plugins_v0.DictPlugin( {"name": "plugin1", "patches": {"patch1": "Hello {{ ID }}"}} ) - plugins.load("plugin1") + plugins.load_all(["plugin1"]) patches = list(plugins.iter_patches("patch1")) self.assertEqual(["Hello {{ ID }}"], patches) diff --git a/tutor/plugins/v0.py b/tutor/plugins/v0.py index bc18612..74c40c0 100644 --- a/tutor/plugins/v0.py +++ b/tutor/plugins/v0.py @@ -146,7 +146,7 @@ class BasePlugin: raise exceptions.TutorError( f"Invalid patch '{patch_name}' in plugin {self.name}. Expected str, got {content.__class__}." ) - hooks.Filters.ENV_PATCH(patch_name).add_item(content) + hooks.Filters.ENV_PATCHES.add_item((patch_name, content)) def _load_tasks(self) -> None: """