code: def test_env_copying() -> None:
      # Regression test to ensure environments are only copied
      # if `copy=True` is given to `Runner._get_adjusted_env.`
      # Test also for path adjustments, if not-`None` `pwd`-value
      # is given to `Runner._get_adjusted_env`.
      runner = Runner()
      for original_env in (None, dict(some_key="value")):
          for cwd in (None, Path("a/b/c")):
              for do_copy in (True, False):
                  adjusted_env = runner._get_adjusted_env(
                      cwd=cwd, env=original_env, copy=do_copy
                  )
                  if original_env is None:
                      assert adjusted_env is None
                  else:
                      assert adjusted_env is not None
                      if do_copy is True:
                          assert adjusted_env is not original_env
                      else:
                          assert adjusted_env is original_env
                      if cwd is None:
                          assert "PWD" not in adjusted_env
                      else:
                          assert "PWD" in adjusted_env
  
imports: from __future__ import annotations
  import logging
  import os
  import signal
  import sys
  import unittest.mock
  from threading import Lock, Thread
  from time import sleep, time
  from typing import Any
  import pytest
  from datalad.tests.utils_pytest import OBSCURE_FILENAME, SkipTest, assert_cwd_unchanged, assert_in, assert_raises, eq_, integration, ok_, ok_file_has_content, skip_if_on_windows, swallow_logs, with_tempfile
  from datalad.utils import CMD_MAX_ARG, Path, on_windows
  from ..None import CommandError, KillOutput, Protocol, Runner, StdOutCapture, StdOutErrCapture
  from .utils import py2cmd
label_desc: Use image node_id 19 for calling a global function with example usage: test_env_copying() without return types