code: def _test_gitannex(host, store, dspath):
      store = Path(store)
  
      dspath = Path(dspath)
      store = Path(store)
  
      ds = Dataset(dspath).create()
  
      populate_dataset(ds)
      assert_repo_status(ds.path)
  
      # set up store:
      io = SSHRemoteIO(host) if host else LocalIO()
      if host:
          store_url = "ria+ssh://{host}{path}".format(
              host=host, path=store
          )
      else:
          store_url = "ria+{}".format(store.as_uri())
  
      create_store(io, store, "1")
  
      # TODO: Re-establish test for version 1
      # version 2: dirhash
      create_ds_in_store(io, store, ds.id, "2", "1")
  
      # add special remote
      init_opts = common_init_opts + ["url={}".format(store_url)]
      ds.repo.init_remote("store", options=init_opts)
  
      from datalad.support.external_versions import external_versions
  
      if "8.20200330" < external_versions["cmd:annex"] < "8.20200624":
          # https://git-annex.branchable.com/bugs/testremote_breeds_way_too_many_instances_of_the_externals_remote/?updated
          raise SkipTest(
              "git-annex might lead to overwhelming number of external "
              "special remote instances"
          )
  
      # run git-annex-testremote
      # note, that we don't want to capture output. If something goes wrong we
      # want to see it in test build's output log.
      ds.repo._call_annex(["testremote", "store"], protocol=NoCapture)
  
imports: import logging
  import stat
  from datalad.api import Dataset, clone, create_sibling_ria
  from datalad.cmd import NoCapture
  from datalad.customremotes.ria_utils import create_ds_in_store, create_store, get_layout_locations
  from datalad.distributed.ora_remote import LocalIO, SSHRemoteIO, _sanitize_key
  from datalad.distributed.tests.ria_utils import common_init_opts, get_all_files, populate_dataset
  from datalad.support.exceptions import CommandError, IncompleteResultsError
  from datalad.tests.utils_pytest import SkipTest, assert_equal, assert_false, assert_in, assert_not_in, assert_raises, assert_repo_status, assert_status, assert_true, has_symlink_capability, known_failure_windows, serve_path_via_http, skip_if_adjusted_branch, skip_if_no_network, skip_if_root, skip_ssh, skip_wo_symlink_capability, slow, swallow_logs, turtle, with_tempfile
  from datalad.utils import Path
label_desc: Use image node_id 16 for calling a global function with example usage: _test_gitannex(host, store, dspath) without return types