fix: cleanup
This commit is contained in:
parent
a724716117
commit
a83a4bedbe
4 changed files with 36 additions and 7 deletions
|
|
@ -1,4 +1,5 @@
|
|||
from hydra import compose, initialize
|
||||
from pathlib import Path
|
||||
from hydra import compose, initialize_config_dir
|
||||
from omegaconf import OmegaConf
|
||||
from brittle_star_project.configs.main_config import BrittleStarConfig
|
||||
from brittle_star_project.configs.register_configs import register_configs
|
||||
|
|
@ -9,11 +10,12 @@ register_configs()
|
|||
|
||||
def test_config_composition_centralized():
|
||||
"""Test that the centralized configuration composes and validates correctly."""
|
||||
with initialize(version_base="1.3", config_path="../configs"):
|
||||
config_dir = str(Path(__file__).parent.parent / "configs")
|
||||
with initialize_config_dir(version_base="1.3", config_dir=config_dir):
|
||||
# We compose the config; it follows main_config.yaml
|
||||
cfg = compose(config_name="main_config", overrides=["architecture=centralized"])
|
||||
|
||||
# Merge with the structured schema and convert to a real dataclass instance to verify validation.
|
||||
# Merge with the structured schema and convert to a real dataclass instance
|
||||
structured_cfg = OmegaConf.to_object(
|
||||
OmegaConf.merge(OmegaConf.structured(BrittleStarConfig), cfg)
|
||||
)
|
||||
|
|
@ -27,7 +29,8 @@ def test_config_composition_centralized():
|
|||
|
||||
def test_config_composition_decentralized():
|
||||
"""Test that the decentralized configuration composes and validates correctly."""
|
||||
with initialize(version_base="1.3", config_path="../configs"):
|
||||
config_dir = str(Path(__file__).parent.parent / "configs")
|
||||
with initialize_config_dir(version_base="1.3", config_dir=config_dir):
|
||||
cfg = compose(config_name="main_config", overrides=["architecture=decentralized"])
|
||||
|
||||
# Merge and convert to dataclass instance
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
import pytest
|
||||
import os
|
||||
import sys
|
||||
|
||||
# CRITICAL for headless cross-platform testing (devcontainers etc)
|
||||
if sys.platform == "linux" and "DISPLAY" not in os.environ and "WAYLAND_DISPLAY" not in os.environ:
|
||||
os.environ.setdefault("MUJOCO_GL", "egl")
|
||||
|
||||
import mujoco
|
||||
from PIL import Image
|
||||
from brittle_star_project.environment.env_config import EnvConfig, MorphologyConfig, ArenaConfig
|
||||
|
|
|
|||
Reference in a new issue