code: def test_push_url(storepath=None, dspath=None, blockfile=None):
      dspath = Path(dspath)
      store = Path(storepath)
      blockfile = Path(blockfile)
      blockfile.touch()
  
      ds = Dataset(dspath).create()
      populate_dataset(ds)
      assert_repo_status(ds.path)
      repo = ds.repo
  
      # set up store:
      io = LocalIO()
      store_url = "ria+{}".format(store.as_uri())
      create_store(io, store, "1")
      create_ds_in_store(io, store, ds.id, "2", "1")
  
      # initremote fails with invalid url (not a ria+ URL):
      invalid_url = (store.parent / "non-existent").as_uri()
      init_opts = common_init_opts + [
          "url={}".format(store_url),
          "push-url={}".format(invalid_url),
      ]
      assert_raises(
          CommandError, ds.repo.init_remote, "store", options=init_opts
      )
  
      # initremote succeeds with valid but inaccessible URL (pointing to a file
      # instead of a store):
      block_url = "ria+" + blockfile.as_uri()
      init_opts = common_init_opts + [
          "url={}".format(store_url),
          "push-url={}".format(block_url),
      ]
      repo.init_remote("store", options=init_opts)
  
      store_uuid = ds.siblings(
          name="store", return_type="item-or-list"
      )["annex-uuid"]
      here_uuid = ds.siblings(name="here", return_type="item-or-list")[
          "annex-uuid"
      ]
  
      # but a push will fail:
      assert_raises(
          CommandError,
          ds.repo.call_annex,
          ["copy", "one.txt", "--to", "store"],
      )
  
      # reconfigure w/ local overwrite:
      repo.config.add(
          "remote.store.ora-push-url", store_url, scope="local"
      )
      # push works now:
      repo.call_annex(["copy", "one.txt", "--to", "store"])
  
      # remove again (config and file from store)
      repo.call_annex(["move", "one.txt", "--from", "store"])
      repo.config.unset("remote.store.ora-push-url", scope="local")
      repo.call_annex(["fsck", "-f", "store"])
      known_sources = repo.whereis("one.txt")
      assert_in(here_uuid, known_sources)
      assert_not_in(store_uuid, known_sources)
  
      # reconfigure (this time committed)
      init_opts = common_init_opts + [
          "url={}".format(store_url),
          "push-url={}".format(store_url),
      ]
      repo.enable_remote("store", options=init_opts)
  
      # push works now:
      repo.call_annex(["copy", "one.txt", "--to", "store"])
      known_sources = repo.whereis("one.txt")
      assert_in(here_uuid, known_sources)
      assert_in(store_uuid, known_sources)
  
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 21 for calling a global function with example usage: test_push_url(storepath, dspath, blockfile) without return types