code: def test_collect_non_existing_dir(tmp_dir, dvc, run_copy_metrics):
      subdir = tmp_dir / "subdir"
      subdir.mkdir()
  
      metric = [
          {"first_val": 100, "val": 2},
          {"first_val": 200, "val": 3},
      ]
      subdir_metric = [{"y": 101, "x": 3}, {"y": 202, "x": 4}]
  
      pname = "source.json"
      (tmp_dir / pname).dump_json(metric, sort_keys=True)
  
      sname = "subdir_source.json"
      (tmp_dir / sname).dump_json(subdir_metric, sort_keys=True)
  
      p1 = os.path.join("subdir", "p1.json")
      p2 = os.path.join("subdir", "p2.json")
      subdir_stage = tmp_dir.dvc.run(
          cmd=(
              f"mkdir subdir && python copy.py {sname} {p1} && "
              f"python copy.py {sname} {p2}"
          ),
          deps=[sname],
          plots=["subdir"],
          name="copy_double",
      )
  
      run_copy_metrics(
          pname,
          "plot.json",
          plots=["plot.json"],
          name="copy-metric",
          commit="there is metric",
      )
  
      remove(subdir_stage.outs[0].cache_path)
      remove(subdir_stage.outs[0].fs_path)
  
      result = dvc.plots.show()
      assert get_plot(
          result,
          "workspace",
          typ="definitions",
          file="",
          endkey="error",
      )
      # make sure others gets loaded
      assert get_plot(result, "workspace", file="plot.json") == metric
  
imports: import json
  import os
  import pytest
  from dvc.cli import main
  from dvc.dvcfile import PROJECT_FILE
  from dvc.exceptions import OverlappingOutputPathsError
  from dvc.repo import Repo
  from dvc.repo.plots import PlotMetricTypeError, onerror_collect
  from dvc.utils.fs import remove
  from dvc.utils.serialize import EncodingError, YAMLFileCorruptedError, modify_yaml
  from tests.utils.plots import get_plot
label_desc: Use image node_id 13 for calling a global function with example usage: test_collect_non_existing_dir(tmp_dir, dvc, run_copy_metrics) without return types