Skip to content
Snippets Groups Projects
Commit 5d15016c authored by Florian Schröder's avatar Florian Schröder
Browse files

Refactor test_start.py for hook callback changes

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.
parent 09e9113b
No related branches found
No related tags found
1 merge request!77Resolve "Remove repitition of Hook callback class in env config"
Pipeline #48359 passed
...@@ -24,7 +24,6 @@ from cooperative_cuisine.game_server import PlayerRequestType ...@@ -24,7 +24,6 @@ from cooperative_cuisine.game_server import PlayerRequestType
from cooperative_cuisine.hooks import ( from cooperative_cuisine.hooks import (
Hooks, Hooks,
SERVE_NOT_ORDERED_MEAL, SERVE_NOT_ORDERED_MEAL,
hooks_via_callback_class,
PLAYER_ADDED, PLAYER_ADDED,
POST_STEP, POST_STEP,
) )
...@@ -502,22 +501,16 @@ def test_score(env_config, layout_config, item_info): ...@@ -502,22 +501,16 @@ def test_score(env_config, layout_config, item_info):
def test_info_msgs(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) env_config_dict = yaml.load(env_config, Loader=yaml.Loader)
# TODO change after merge with 115 # TODO change after merge with 115
env_config_dict["extra_setup_functions"]["dummy_msg"] = { env_config_dict["hook_callbacks"]["dummy_msg"] = {
"func": hooks_via_callback_class, "hooks": [PLAYER_ADDED],
"kwargs": { "callback_class": InfoMsgManager,
"hooks": [PLAYER_ADDED], "callback_class_kwargs": {"msg": "hello there"},
"callback_class": InfoMsgManager,
"callback_class_kwargs": {"msg": "hello there"},
},
} }
env_config_dict["extra_setup_functions"]["dummy_msg_2"] = { env_config_dict["hook_callbacks"]["dummy_msg_2"] = {
"func": hooks_via_callback_class, "hooks": [POST_STEP],
"kwargs": { "callback_class": InfoMsgManager,
"hooks": [POST_STEP], "callback_class_kwargs": {"msg": "step step"},
"callback_class": InfoMsgManager,
"callback_class_kwargs": {"msg": "step step"},
},
} }
env_config = yaml.dump(env_config_dict) env_config = yaml.dump(env_config_dict)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment