class_docstr: Adds integration with ya, helps in finding dependencies
class_docstr_tok: ["Adds","integration","with","ya",",","helps","in","finding","dependencies"]
code: def __init__(
      self,
      mode=None,
      source_root=None,
      build_root=None,
      dep_roots=None,
      output_dir=None,
      test_params=None,
      context=None,
      python_path=None,
      valgrind_path=None,
      gdb_path=None,
      data_root=None,
      env_file=None,
  ):
      context_file_path = os.environ.get("YA_TEST_CONTEXT_FILE", None)
      if context_file_path:
          with open(context_file_path, "r") as afile:
              test_context = json.load(afile)
          context_runtime = test_context["runtime"]
          context_internal = test_context.get("internal", {})
          context_build = test_context.get("build", {})
          context_resources = test_context.get("resources", {})
      else:
          context_runtime = {}
          context_internal = {}
          context_build = {}
          context_resources = {}
      self._mode = mode
      self._build_root = (
          to_str(context_runtime.get("build_root", "")) or build_root
      )
      self._source_root = (
          to_str(context_runtime.get("source_root", ""))
          or source_root
          or self._detect_source_root()
      )
      self._output_dir = (
          to_str(context_runtime.get("output_path", ""))
          or output_dir
          or self._detect_output_root()
      )
      if not self._output_dir:
          raise Exception("Run ya make -t before running test binary")
      if not self._source_root:
          logging.warning(
              "Source root was not set neither determined, use --source-root to set it explicitly"
          )
      if not self._build_root:
          if self._source_root:
              self._build_root = self._source_root
          else:
              logging.warning(
                  "Build root was not set neither determined, use --build-root to set it explicitly"
              )
  
      if data_root:
          self._data_root = data_root
      elif self._source_root:
          self._data_root = os.path.abspath(
              os.path.join(
                  self._source_root, "..", "arcadia_tests_data"
              )
          )
  
      self._dep_roots = dep_roots
  
      self._python_path = (
          to_str(context_runtime.get("python_bin", "")) or python_path
      )
      self._valgrind_path = valgrind_path
      self._gdb_path = (
          to_str(context_runtime.get("gdb_bin", "")) or gdb_path
      )
      self._test_params = {}
      self._context = {}
      self._test_item_node_id = None
  
      ram_drive_path = to_str(context_runtime.get("ram_drive_path", ""))
      if ram_drive_path:
          self._test_params["ram_drive_path"] = ram_drive_path
      if test_params:
          self._test_params.update(
              dict(x.split("=", 1) for x in test_params)
          )
      self._test_params.update(context_runtime.get("test_params", {}))
  
      self._context["project_path"] = context_runtime.get(
          "project_path"
      )
      self._context["modulo"] = context_runtime.get("split_count", 1)
      self._context["modulo_index"] = context_runtime.get(
          "split_index", 0
      )
      self._context["work_path"] = to_str(
          context_runtime.get("work_path")
      )
      self._context["test_tool_path"] = context_runtime.get(
          "test_tool_path"
      )
      self._context["test_output_ram_drive_path"] = to_str(
          context_runtime.get("test_output_ram_drive_path")
      )
      self._context["retry_index"] = context_runtime.get("retry_index")
  
      self._context["ya_global_resources"] = context_resources.get(
          "global"
      )
  
      self._context["sanitize"] = context_build.get("sanitizer")
      self._context["ya_trace_path"] = context_internal.get(
          "trace_file"
      )
  
      self._env_file = context_internal.get("env_file") or env_file
  
      if context:
          for k, v in context.items():
              if k not in self._context or v is not None:
                  self._context[k] = v
  
      if self._env_file and os.path.exists(self._env_file):
          yatest_logger.debug(
              "Reading variables from env_file at %s", self._env_file
          )
          var_list = []
          with open(self._env_file) as file:
              for ljson in file.readlines():
                  variable = json.loads(ljson)
                  for key, value in six.iteritems(variable):
                      os.environ[key] = str(value)
                      var_list.append(key)
          yatest_logger.debug("Variables loaded: %s", var_list)
  
imports: import os
  import sys
  import logging
  import json
  import six
  from .tools import to_str
  from .external import ExternalDataInfo
label_desc: Use image node_id 1 to create a new Ya object from inherited base classes: object with example: obj = Ya(mode, source_root, build_root, dep_roots, output_dir, test_params, context, python_path, valgrind_path, gdb_path, data_root, env_file)