docstr: Make sure mock keepalive is called.
docstr_tok: ["Make","sure","mock","keepalive","is","called","."]
code: def test_keepalive(self):
      """Make sure mock keepalive is called."""
      with self._patch_mailbox() as (event_mock, _):
          mailbox = Mailbox()
          mailbox.enable_keepalive()
  
          record = pb.Record()
          iface = Mock(
              spec_set=[
                  "publish",
                  "_publish",
                  "transport_failed",
                  "_transport_mark_failed",
                  "_transport_mark_success",
                  "_transport_keepalive_failed",
              ]
          )
          iface.transport_failed = Mock(return_value=False)
          iface._transport_keepalive_failed = Mock(return_value=False)
  
          handle = mailbox._deliver_record(record, iface)
          _ = handle.wait(timeout=2)
          self.assertEqual(
              iface._transport_keepalive_failed.call_count, 2
          )
  
imports: import sys
  import threading
  import time
  from contextlib import contextmanager
  from unittest import TestCase
  from unittest.mock import Mock, patch
  from parameterized import parameterized
  from wandb.proto import wandb_internal_pb2
  from wandb.sdk.lib.mailbox import Mailbox, MailboxProbe, MailboxProgress
label_desc: Use image node_id 6 for calling the TestWithMockedTime obj's underlying member method code with example usage: obj.test_keepalive() without return types