code: def get_test_data_repo():
      """Return the path to a git repository with the required commit checked
      out.
  
      If the repository does not exist, then it is cloned from
      https://github.com/vispy/test-data. If the repository already exists
      then the required commit is checked out.
      """
      # This tag marks the test-data commit that this version of vispy should
      # be tested against. When adding or changing test images, create
      # and push a new tag and update this variable.
      test_data_tag = "test-data-10"
  
      data_path = config["test_data_path"]
      git_path = "http://github.com/vispy/test-data"
      gitbase = git_cmd_base(data_path)
  
      if os.path.isdir(data_path):
          # Already have a test-data repository to work with.
  
          # Get the commit ID of test_data_tag. Do a fetch if necessary.
          try:
              tag_commit = git_commit_id(data_path, test_data_tag)
          except NameError:
              cmd = gitbase + ["fetch", "--tags", "origin"]
              print(" ".join(cmd))
              check_call(cmd)
              try:
                  tag_commit = git_commit_id(data_path, test_data_tag)
              except NameError:
                  raise Exception(
                      "Could not find tag '%s' in test-data repo at"
                      " %s" % (test_data_tag, data_path)
                  )
          except Exception:
              if not os.path.exists(os.path.join(data_path, ".git")):
                  raise Exception(
                      "Directory '%s' does not appear to be a git "
                      "repository. Please remove this directory."
                      % data_path
                  )
              else:
                  raise
  
          # If HEAD is not the correct commit, then do a checkout
          if git_commit_id(data_path, "HEAD") != tag_commit:
              print("Checking out test-data tag '%s'" % test_data_tag)
              check_call(gitbase + ["checkout", test_data_tag])
  
      else:
          print(
              "Attempting to create git clone of test data repo in %s.."
              % data_path
          )
  
          parent_path = os.path.split(data_path)[0]
          if not os.path.isdir(parent_path):
              os.makedirs(parent_path)
  
          if IS_CI:
              # Create a shallow clone of the test-data repository (to avoid
              # downloading more data than is necessary)
              os.makedirs(data_path)
              cmds = [
                  gitbase + ["init"],
                  gitbase + ["remote", "add", "origin", git_path],
                  gitbase
                  + [
                      "fetch",
                      "--tags",
                      "origin",
                      test_data_tag,
                      "--depth=1",
                  ],
                  gitbase + ["checkout", "-b", "main", "FETCH_HEAD"],
              ]
          else:
              # Create a full clone
              cmds = [["git", "clone", git_path, data_path]]
  
          for cmd in cmds:
              print(" ".join(cmd))
              rval = check_call(cmd)
              if rval == 0:
                  continue
              raise RuntimeError(
                  "Test data path '%s' does not exist and could "
                  "not be created with git. Either create a git "
                  "clone of %s or set the test_data_path "
                  "variable to an existing clone."
                  % (data_path, git_path)
              )
  
      return data_path
  
imports: import time
  import os
  import sys
  import inspect
  import base64
  from subprocess import check_call, CalledProcessError
  import numpy
  from http.client import HTTPConnection
  from urllib.parse import urlencode
  from ..None import scene, config
  from ..io import read_png, write_png
  from ..gloo.util import _screenshot
  from ..util import run_subprocess
  from .None import IS_CI
label_desc: Use image node_id 8 for calling a global function with example usage: get_test_data_repo() and returns: data_path