Skip to content

Commit

Permalink
Add docs and comments for posterity in plugin tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drewj-tp committed Sep 17, 2024
1 parent 9dbbca2 commit b1270c9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion armi/tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ def defineFlags():


class SillyAxialExpansionChanger(AxialExpansionChanger):
pass
"""Fake, test-specific axial expansion changer that a plugin will register."""


class SillyAxialPlugin(plugins.ArmiPlugin):
"""Trivial plugin that implements the axial expansion hook."""

@staticmethod
@plugins.HOOKIMPL
def getAxialExpansionChanger() -> type[SillyAxialExpansionChanger]:
Expand Down Expand Up @@ -109,9 +111,12 @@ def test_axialExpansionHook(self):
"""Test that plugins can override the axial expansion of assemblies via a hook."""
pm = self.app.pluginManager
first = pm.hook.getAxialExpansionChanger()
# By default, make sure we get the armi-shipped expansion class
self.assertIs(first, AxialExpansionChanger)
pm.register(SillyAxialPlugin)
second = pm.hook.getAxialExpansionChanger()
# Registering a plugin that implements the hook means we get
# that plugin's axial expander
self.assertIs(second, SillyAxialExpansionChanger)


Expand Down

0 comments on commit b1270c9

Please sign in to comment.