Skip to content

test_checkpoint

CPU-only unit tests for :mod:fastvideo.train.utils.checkpoint.

Covers the pure-Python portions of the checkpoint manager: name parsing, resume-path resolution, metadata round-trip, rolling-delete cleanup, the _is_stateful predicate, and the maybe_save gating logic. Code paths that touch DCP (dcp.save / dcp.load) and CUDA RNG snapshots are intentionally not covered here — those need a GPU runner and will be tested in later phases.

Classes

Functions

fastvideo.tests.train.utils.test_checkpoint.test_resolve_unknown_dir_raises

test_resolve_unknown_dir_raises(tmp_path: Path) -> None

A dir that is neither a checkpoint nor an output_dir-with-checkpoints.

Source code in fastvideo/tests/train/utils/test_checkpoint.py
def test_resolve_unknown_dir_raises(tmp_path: Path) -> None:
    """A dir that is neither a checkpoint nor an output_dir-with-checkpoints."""
    bogus = tmp_path / "bogus"
    bogus.mkdir()
    with pytest.raises(ValueError, match="Could not resolve"):
        _resolve_resume_checkpoint(str(bogus), output_dir=str(tmp_path))