code: def test_external_cache_dir(tmp_dir, dvc, make_tmp_dir):
      cache_dir = make_tmp_dir("cache")
  
      with dvc.config.edit() as conf:
          conf["cache"]["dir"] = cache_dir.fs_path
      assert not os.path.exists(dvc.cache.local.path)
      dvc.cache = CacheManager(dvc)
  
      tmp_dir.dvc_gen({"foo": "foo"})
  
      tmp_dir.dvc_gen(
          {
              "data_dir": {
                  "data": "data_dir/data",
                  "data_sub_dir": {
                      "data_sub": "data_dir/data_sub_dir/data_sub"
                  },
              }
          }
      )
  
      assert not os.path.exists(".dvc/cache")
      assert len(os.listdir(cache_dir)) != 0
  
file_path: dvc/tests/func/test_odb.py
imports: import os
  import stat
  import configobj
  import pytest
  from dvc.cachemgr import CacheManager
  from dvc.cli import main
  from dvc.utils import relpath
  from dvc_data.hashfile.hash_info import HashInfo
  from dvc_objects.errors import ObjectFormatError
label_desc: Use image node_id 3 for calling a global function with example usage: test_external_cache_dir(tmp_dir, dvc, make_tmp_dir) without return types