code: def check_env_var(name, expected, *, expect_warning=False):
      code = f"""if 1:
          import pyarrow as pa
  
          pool = pa.default_memory_pool()
          assert pool.backend_name in {expected!r}, pool.backend_name
          """
      env = dict(os.environ)
      env["ARROW_DEFAULT_MEMORY_POOL"] = name
      res = subprocess.run(
          [sys.executable, "-c", code],
          env=env,
          universal_newlines=True,
          stderr=subprocess.PIPE,
      )
      if res.returncode != 0:
          print(res.stderr, file=sys.stderr)
          res.check_returncode()  # fail
      errlines = res.stderr.splitlines()
      if expect_warning:
          assert len(errlines) in (1, 2)
          if len(errlines) == 1:
              # ARROW_USE_GLOG=OFF
              assert f"Unsupported backend '{name}'" in errlines[0]
          else:
              # ARROW_USE_GLOG=ON
              assert "InitGoogleLogging()" in errlines[0]
              assert f"Unsupported backend '{name}'" in errlines[1]
      else:
          assert len(errlines) == 0
  
imports: import contextlib
  import os
  import signal
  import subprocess
  import sys
  import weakref
  import pyarrow
  import pytest
label_desc: Use image node_id 10 for calling a global function with example usage: check_env_var(name, expected) without return types