code: def create_test_dir(
      test_id: int,
      input_files: List[str],
      test_base_dir: Path,
      test_ref_dir: Path,
      dependencies: List[int] = [],
  ) -> Path:
      test_working_dir = test_base_dir.joinpath(f"test_{test_id}")
      test_working_dir.mkdir(parents=True, exist_ok=True)
  
      # Required as workaround until #2686 is fixed.
      (test_working_dir / "models").mkdir(parents=True, exist_ok=True)
  
      for f in input_files:
          file_to_copy = None
          search_paths = [test_ref_dir / f]
          if len(dependencies) > 0:
              search_paths.extend(
                  [
                      (test_base_dir / f"test_{x}" / f)
                      for x in dependencies
                  ]
              )
              search_paths.extend(
                  [
                      (
                          test_base_dir
                          / f"test_{x}"
                          / os.path.basename(f)
                      )
                      for x in dependencies
                  ]
              )  # for input_files with a full path
          for search_path in search_paths:
              if search_path.exists() and not search_path.is_dir():
                  file_to_copy = search_path
                  break
  
          if file_to_copy is None:
              str_deps = [str(dep) for dep in dependencies]
              dependent_tests = ", ".join(str_deps)
              raise ValueError(
                  f"Input file '{f}' couldn't be found for test {test_id}. Searched in '{test_ref_dir}' as well as outputs of dependent tests: [{dependent_tests}]"
              )
  
          test_dest_file = test_working_dir / f
          if file_to_copy == test_dest_file:
              continue
          test_dest_file.parent.mkdir(parents=True, exist_ok=True)
          # We always want to replace this file in case it is the output of another test
          if test_dest_file.exists():
              test_dest_file.unlink()
          shutil.copy(str(file_to_copy), str(test_dest_file))
      return test_working_dir
  
imports: import shutil
  import threading
  import argparse
  import difflib
  from pathlib import Path
  import re
  import os
  import subprocess
  import sys
  import traceback
  import shlex
  import math
  import json
  from concurrent.futures import ThreadPoolExecutor, Future
  from enum import Enum
  import socket
  from typing import Any, Callable, Dict, List, Mapping, Optional, Set, Tuple, Type, Union, cast
  from run_tests_common import TestData
  import runtests_flatbuffer_converter
label_desc: Use image node_id 13 for calling a global function with example usage: create_test_dir(test_id, input_files, test_base_dir, test_ref_dir, dependencies) and returns: test_working_dir