Skip to content
Snippets Groups Projects

Resolve "Remove repitition of Hook callback class in env config"

1 file
+ 8
15
Compare changes
  • Side-by-side
  • Inline
  • Removed the 'hooks_via_callback_class' usage and replaced it with 'hook_callbacks'. The 'extra_setup_functions' field has been renamed to 'hook_callbacks' to provide a more accurate description of its role. The callback logic has consequently been adjusted, reducing verbosity and simplifying the code.
+ 8
15
@@ -24,7 +24,6 @@ from cooperative_cuisine.game_server import PlayerRequestType
from cooperative_cuisine.hooks import (
Hooks,
SERVE_NOT_ORDERED_MEAL,
hooks_via_callback_class,
PLAYER_ADDED,
POST_STEP,
)
@@ -502,22 +501,16 @@ def test_score(env_config, layout_config, item_info):
def test_info_msgs(env_config, layout_config, item_info):
env_config_dict = yaml.load(env_config, Loader=yaml.Loader)
# TODO change after merge with 115
env_config_dict["extra_setup_functions"]["dummy_msg"] = {
"func": hooks_via_callback_class,
"kwargs": {
"hooks": [PLAYER_ADDED],
"callback_class": InfoMsgManager,
"callback_class_kwargs": {"msg": "hello there"},
},
env_config_dict["hook_callbacks"]["dummy_msg"] = {
"hooks": [PLAYER_ADDED],
"callback_class": InfoMsgManager,
"callback_class_kwargs": {"msg": "hello there"},
}
env_config_dict["extra_setup_functions"]["dummy_msg_2"] = {
"func": hooks_via_callback_class,
"kwargs": {
"hooks": [POST_STEP],
"callback_class": InfoMsgManager,
"callback_class_kwargs": {"msg": "step step"},
},
env_config_dict["hook_callbacks"]["dummy_msg_2"] = {
"hooks": [POST_STEP],
"callback_class": InfoMsgManager,
"callback_class_kwargs": {"msg": "step step"},
}
env_config = yaml.dump(env_config_dict)
Loading