code: def _impl_test_interactive_timers():
      # A timer with <1 millisecond gets converted to int and therefore 0
      # milliseconds, which the mac framework interprets as singleshot.
      # We only want singleshot if we specify that ourselves, otherwise we want
      # a repeating timer
      import os
      from unittest.mock import Mock
      import matplotlib.pyplot as plt
  
      # increase pause duration on CI to let things spin up
      # particularly relevant for gtk3cairo
      pause_time = 2 if os.getenv("CI") else 0.5
      fig = plt.figure()
      plt.pause(pause_time)
      timer = fig.canvas.new_timer(0.1)
      mock = Mock()
      timer.add_callback(mock)
      timer.start()
      plt.pause(pause_time)
      timer.stop()
      assert mock.call_count > 1
  
      # Now turn it into a single shot timer and verify only one gets triggered
      mock.call_count = 0
      timer.single_shot = True
      timer.start()
      plt.pause(pause_time)
      assert mock.call_count == 1
  
      # Make sure we can start the timer a second time
      timer.start()
      plt.pause(pause_time)
      assert mock.call_count == 2
      plt.close("all")
  
imports: import functools
  import importlib
  import importlib.util
  import inspect
  import json
  import os
  import platform
  import signal
  import subprocess
  import sys
  import tempfile
  import time
  import urllib.request
  from PIL import Image
  import pytest
  import matplotlib
  from matplotlib import _c_internal_utils
  from matplotlib.backend_tools import ToolToggleBase
  from matplotlib.testing import subprocess_run_helper
label_desc: Use image node_id 26 for calling a global function with example usage: _impl_test_interactive_timers() without return types