code: def _examples(fnames_str):
      """Run examples and make sure they work.
  
      Parameters
      ----------
      fnames_str : str
          Can be a space-separated list of paths to test, or an empty string to
          auto-detect and run all examples.
      """
      import_dir, dev = _get_import_dir()
      reason = None
      if not dev:
          reason = "Cannot test examples unless in vispy git directory"
      else:
          with use_log_level("warning", print_msg=False):
              good, backend = has_application(capable=("multi_window",))
          if not good:
              reason = "Must have suitable app backend"
      if reason is not None:
          raise VispySkipSuite("Skipping example test: %s" % reason)
  
      # if we're given individual file paths as a string in fnames_str,
      # then just use them as the fnames
      # otherwise, use the full example paths that have been
      # passed to us
      if fnames_str:
          examples_dir = ""
          fnames = fnames_str.split(" ")
  
      else:
          examples_dir = op.join(import_dir, "..", "examples")
          fnames = [
              op.join(d[0], fname)
              for d in os.walk(examples_dir)
              for fname in d[2]
              if fname.endswith(".py")
          ]
  
      fnames = sorted(fnames, key=lambda x: x.lower())
      print(
          _line_sep + "\nRunning examples using %s backend" % (backend,)
      )
      op.join("tutorial", "app", "shared_context.py"),  # non-standard
  
      fails = []
      n_ran = n_skipped = 0
      t0 = time()
      for fi, fname in enumerate(fnames):
          n_ran += 1
          root_name = fname[-len(fname) + len(examples_dir) :]
          good = True
          with open(fname, "rb") as fid:
              for _ in range(10):  # just check the first 10 lines
                  line = fid.readline().decode("utf-8")
                  if line == "":
                      break
                  elif (
                      line.startswith("# vispy: ")
                      and "testskip" in line
                  ):
                      good = False
                      break
          if _skip_example(fname):
              print(
                  "Skipping example that fails on Travis CI: {}".format(
                      fname
                  )
              )
              good = False
          if not good:
              n_ran -= 1
              n_skipped += 1
              continue
          line_str = "[%3d/%3d] %s" % (fi + 1, len(fnames), root_name)
          print(line_str.ljust(len(_line_sep) - 1), end="")
          sys.stdout.flush()
          cwd = op.dirname(fname)
          cmd = [
              sys.executable,
              "-c",
              _script.format(op.split(fname)[1][:-3]),
          ]
          sys.stdout.flush()
          stdout, stderr, retcode = run_subprocess(
              cmd, return_code=True, cwd=cwd, env=os.environ
          )
          if retcode or len(stderr.strip()) > 0:
              # Skipping due to missing dependency is okay
              if "ImportError: " in stderr:
                  print("S")
              else:
                  ext = "\n" + _line_sep + "\n"
                  fails.append(
                      "X%sExample %s failed (%s):%s%s%s"
                      % (ext, root_name, retcode, ext, stderr, ext)
                  )
                  print(fails[-1])
          else:
              print("✓")
          sys.stdout.flush()
      print("")
      t = ": %s failed, %s succeeded, %s skipped in %s seconds" % (
          len(fails),
          n_ran - len(fails),
          n_skipped,
          round(time() - t0),
      )
      if len(fails) > 0:
          raise RuntimeError("Failed%s" % t)
      print("Success%s" % t)
  
imports: from __future__ import print_function
  import sys
  import os
  import warnings
  from os import path
  from copy import deepcopy
  from functools import partial
  from ..util import use_log_level, run_subprocess
  from ..util.ptime import time
  from ._testing import has_application, nottest, IS_CI, IS_TRAVIS_CI
label_desc: Use image node_id 7 for calling a global function with example usage: _examples(fnames_str) without return types