Skip to content

Commit

Permalink
add reloading test
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobettini committed Nov 27, 2024
1 parent b4c678b commit 23ed668
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions test/test_magent.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from benchmarl.experiment import Experiment

from utils import _has_magent2
from utils_experiment import ExperimentUtils


@pytest.mark.skipif(not _has_magent2, reason="magent2 not found")
Expand Down Expand Up @@ -91,26 +92,26 @@ def test_lstm(
)
experiment.run()

# @pytest.mark.parametrize("algo_config", algorithm_config_registry.values())
# @pytest.mark.parametrize("task", [MAgentTask.ADVERSARIAL_PURSUIT])
# def test_reloading_trainer(
# self,
# algo_config: AlgorithmConfig,
# task: Task,
# experiment_config,
# cnn_sequence_config,
# ):
# # To not run unsupported algo-task pairs
# if not algo_config.supports_discrete_actions():
# pytest.skip()
# algo_config = algo_config.get_from_yaml()
#
# ExperimentUtils.check_experiment_loading(
# algo_config=algo_config,
# model_config=cnn_sequence_config,
# experiment_config=experiment_config,
# task=task.get_from_yaml(),
# )
@pytest.mark.parametrize("algo_config", IppoConfig)
@pytest.mark.parametrize("task", [MAgentTask.ADVERSARIAL_PURSUIT])
def test_reloading_trainer(
self,
algo_config: AlgorithmConfig,
task: Task,
experiment_config,
cnn_sequence_config,
):
# To not run unsupported algo-task pairs
if not algo_config.supports_discrete_actions():
pytest.skip()
algo_config = algo_config.get_from_yaml()

ExperimentUtils.check_experiment_loading(
algo_config=algo_config,
model_config=cnn_sequence_config,
experiment_config=experiment_config,
task=task.get_from_yaml(),
)

@pytest.mark.parametrize("algo_config", [QmixConfig, IppoConfig, MasacConfig])
@pytest.mark.parametrize("task", [MAgentTask.ADVERSARIAL_PURSUIT])
Expand Down

0 comments on commit 23ed668

Please sign in to comment.