code: def test_notebooks():
      """
      Run all notebooks in the directories given by the list `notebook_paths`.
  
      The notebooks are run locally using [treon](https://github.com/ReviewNB/treon)
      and executed in each directory so that local resources can be imported.
  
      Returns:
          num_errors (int): Number of notebooks that failed to run
          num_passed (int): Number of notebooks that successfully run
      """
      num_errors = 0
      num_passed = 0
      for nb_path in notebook_paths:
          abs_nb_path = os.path.join(SGDIR, nb_path)
          cmd_line = f"treon . --threads=2"
  
          print(f"\033[1;33;40m Running {abs_nb_path}\033[0m")
  
          # Add path to PYTHONPATH
          environ = dict(os.environ, PYTHONPATH=abs_nb_path)
  
          procout = subprocess.run(
              cmd_line,
              shell=True,
              check=False,
              env=environ,
              cwd=abs_nb_path,
              # stdout=subprocess.PIPE,
              # stderr=subprocess.PIPE,
          )
  
          if procout.returncode != 0:
              num_errors += 1
  
          else:
              num_passed += 1
  
          print()
      return num_errors, num_passed
  
imports: import os
  import sys
  import subprocess
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: test_notebooks() and returns: num_errors,  num_passed