forked from facebookresearch/BenchMARL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_algorithm.py
26 lines (22 loc) · 959 Bytes
/
test_algorithm.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import pytest
from benchmarl.algorithms import algorithm_config_registry
from benchmarl.algorithms.common import AlgorithmConfig
from benchmarl.hydra_config import load_algorithm_config_from_hydra
from hydra import compose, initialize
@pytest.mark.parametrize("algo_name", algorithm_config_registry.keys())
def test_loading_algorithms(algo_name):
with initialize(version_base=None, config_path="../benchmarl/conf"):
cfg = compose(
config_name="config",
overrides=[
f"algorithm={algo_name}",
"task=vmas/balance",
],
)
algo_config: AlgorithmConfig = load_algorithm_config_from_hydra(cfg.algorithm)
assert algo_config == algorithm_config_registry[algo_name].get_from_yaml()