Skip to content

Testing

This page describes the current test posture for the modules present in this repository.


Running Tests

From the project root:

pixi run test

With coverage:

pixi run test-cov

The test configuration is in pytest.ini.


Current Coverage Priorities

The highest-value tests for this repository are:

  • Configuration loading with config_loader.load().
  • CLI parsing in config.cli.
  • Logger setup behavior in config.logconf.
  • Input cleanup and mapping behavior in processing.cleanup and processing.map.
  • Small synthetic optimization runs through kinopt.local and kinopt.evol.
  • Post-fit and KKT diagnostics in kinopt.fitanalysis and kinopt.optimality.

Unit Test Pattern

Use pytest fixtures such as tmp_path for file-I/O behavior:

from config.logconf import setup_logger


def test_logger_creates_log_dir(tmp_path):
    log_dir = str(tmp_path / "logs")
    setup_logger(name="test", log_dir=log_dir)
    assert (tmp_path / "logs").exists()

Integration Test Pattern

Useful integration tests should use small synthetic CSV files and assert concrete outputs:

  • Run processing.cleanup on a minimal raw fixture.
  • Run kinopt.local with a small input table.
  • Run kinopt.fitanalysis or kinopt.optimality against generated result files.