forked from overhangio/tutor
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add missing test fixture and changelog entry
We somehow forgot to include these files in a previous commit...
- Loading branch information
1 parent
d879573
commit 020787e
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- [Bugfix] Actually update the environment on `tutor plugins enable ...`. (by @regisb) | ||
- [Feature] Introduce a `tutor.hooks.lru_cache` decorator that is automatically cleared whenever a plugin is loaded or unloaded. This is useful, in particular when a plugin implements a costly function that depends on tutor hooks. (by @regisb) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from __future__ import annotations | ||
|
||
from tests.helpers import PluginsTestCase | ||
from tutor import hooks, plugins | ||
|
||
|
||
class PluginsTests(PluginsTestCase): | ||
def test_env_patches_updated_on_new_plugin(self) -> None: | ||
self.assertEqual([], list(plugins.iter_patches("mypatch"))) | ||
|
||
hooks.Filters.ENV_PATCHES.add_item(("mypatch", "hello!")) | ||
|
||
# env patches cache should be cleared on new plugin | ||
hooks.Actions.PLUGIN_LOADED.do("dummyplugin") | ||
|
||
self.assertEqual(["hello!"], list(plugins.iter_patches("mypatch"))) |