Skip to content

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.

1
2
3
4
5
6
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.

1
2
3
4
5
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.

1
2
3
4
5
6
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.

1
2
3
4
5
6
7
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.

1
2
3
4
5
6
7
8
9
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"

Running Testsยถ

python -m pytest tests/test_configs.py