Configs Module Testsโ๏ธ
Overviewโ๏ธ
The configs module tests (test_configs.py) verify the configuration management functionality, including path definitions, scheduler detection, and configuration utilities.
Test Casesโ๏ธ
test_paths_existโ๏ธ
Verifies that all important paths defined in the configs module exist.
def test_paths_exist(self):
"""Test that important paths exist."""
assert configs.HERE.exists()
assert configs.PROJECT_DIR.exists()
assert configs.CONF_DIR.exists()
assert configs.BIN_DIR.exists()
test_scheduler_detectionโ๏ธ
Tests the scheduler detection functionality.
def test_scheduler_detection(self):
"""Test scheduler detection."""
scheduler = configs.get_scheduler()
assert scheduler is not None
assert isinstance(scheduler, str)
test_command_existsโ๏ธ
Verifies the command existence checking function.
def test_command_exists(self):
"""Test command_exists function."""
# Test with a command that should exist
assert configs.command_exists("python") is True
# Test with a command that should not exist
assert configs.command_exists("nonexistent_command_xyz") is False
test_logging_configโ๏ธ
Tests the logging configuration generation.
def test_logging_config(self):
"""Test get_logging_config function."""
config = configs.get_logging_config()
assert isinstance(config, dict)
assert "version" in config
assert "handlers" in config
assert "loggers" in config
test_train_configโ๏ธ
Verifies the TrainConfig dataclass functionality.
def test_train_config(self):
"""Test TrainConfig dataclass."""
config = configs.TrainConfig(
model_name_or_path="test-model",
output_dir="/tmp/test",
# ... other parameters
)
assert config.model_name_or_path == "test-model"
assert config.output_dir == "/tmp/test"