code: def clres(request):
      """
      Create both file csv and log for testing
      :yield: class of both files paths
      """
  
      class CreateCsvLog:
          """
          Create a test and log paths
          """
  
          def __init__(self, csv, log, pattern):
              self.exp_path = csv
              self.stdout = open(log, "w")
              self.fn_pattern = pattern
  
          @property
          def experiment_path(self):
              return self.exp_path
  
          @property
          def stdout_path(self):
              return self.stdout
  
          @experiment_path.setter
          def experiment_path(self, val):
              self.exp_path = val
  
          @stdout_path.setter
          def stdout_path(self, val):
              self.stdout = open(val, "w")
  
      # get preset name from test request params
      idx = (
          0
          if "preset" in list(request.node.funcargs.items())[0][0]
          else 1
      )
      p_name = list(request.node.funcargs.items())[idx][1]
  
      p_valid_params = p_utils.validation_params(p_name)
  
      sys.path.append(".")
      test_name = "ExpName_{}".format(p_name)
      test_path = os.path.join(Def.Path.experiments, test_name)
      if path.exists(test_path):
          shutil.rmtree(test_path)
  
      # get the stdout for logs results
      log_file_name = "test_log_{}.txt".format(p_name)
      fn_pattern = (
          "*.csv" if p_valid_params.num_workers > 1 else "worker_0*.csv"
      )
  
      res = CreateCsvLog(test_path, log_file_name, fn_pattern)
  
      yield res
  
      # clean files
      if path.exists(res.exp_path):
          shutil.rmtree(res.exp_path)
  
      if path.exists(res.stdout.name):
          os.remove(res.stdout.name)
  
file_path: coach/rl_coach/tests/conftest.py
imports: import os
  import shutil
  import sys
  import pytest
  import rl_coach.tests.utils.args_utils
  import rl_coach.tests.utils.presets_utils
  from rl_coach.tests.utils.definitions import Definitions
  from os import path
label_desc: Use image node_id 6 for calling a global function with example usage: clres(request) and returns: self, self