def test_ioerror_if_replay_dir_creation_fails(
    mock_ensure_failure, replay_test_dir
) -> None:
    """Test that replay.dump raises when the replay_dir cannot be created."""
    with pytest.raises(OSError):
        replay.dump(replay_test_dir, 'foo', {'cookiecutter': {'hello': 'world'}})

    mock_ensure_failure.assert_called_once_with(replay_test_dir)
Test that replay.dump raises when the replay_dir cannot be created.
tests/replay/test_dump.py