def test_comet_experiment_is_still_alive_after_training_complete(comet_mock):
    """Test that the CometLogger will not end an experiment after training is complete."""

    logger = CometLogger()
    assert logger.experiment is not None

    logger._experiment = Mock()
    logger.finalize("ended")

    # Assert that data was saved to comet.com
    logger._experiment.flush.assert_called_once()

    # Assert that was not ended
    logger._experiment.end.assert_not_called()
Test that the CometLogger will not end an experiment after training is complete.
tests/tests_pytorch/loggers/test_comet.py