def test_hpc_max_ckpt_version(tmp_path):
    """Test that the _CheckpointConnector is able to find the hpc checkpoint file with the highest version."""
    model = BoringModel()
    trainer = Trainer(default_root_dir=tmp_path, max_steps=1)
    trainer.fit(model)
    trainer.save_checkpoint(tmp_path / "hpc_ckpt.ckpt")
    trainer.save_checkpoint(tmp_path / "hpc_ckpt_0.ckpt")
    trainer.save_checkpoint(tmp_path / "hpc_ckpt_3.ckpt")
    trainer.save_checkpoint(tmp_path / "hpc_ckpt_33.ckpt")

    assert trainer._checkpoint_connector._hpc_resume_path == str(tmp_path / "hpc_ckpt_33.ckpt")
    assert trainer._checkpoint_connector._CheckpointConnector__max_ckpt_version_in_folder(tmp_path) == 33
    assert (
        trainer._checkpoint_connector._CheckpointConnector__max_ckpt_version_in_folder(tmp_path / "not" / "existing")
        is None
    )
Test that the _CheckpointConnector is able to find the hpc checkpoint file with the highest version.
tests/tests_pytorch/trainer/connectors/test_checkpoint_connector.py