code: def test_environment(temp_dir_path: str = "") -> None:
      # Ensure that the subprocess sees a string in `$PWD`, even if a Path-object
      # is provided to `cwd`.
      cmd = py2cmd("import os; print(os.environ['PWD'])")
      cwd = Path(temp_dir_path)
      env = dict(SYSTEMROOT=os.environ.get("SYSTEMROOT", ""))
      runner = Runner()
      results = runner.run(
          cmd=cmd, protocol=StdOutCapture, cwd=cwd, env=env
      )
      assert isinstance(results, dict)
      output = results["stdout"].splitlines()[0]
      assert output == temp_dir_path
  
      runner = Runner(cwd=cwd, env=env)
      results = runner.run(cmd=cmd, protocol=StdOutCapture)
      assert isinstance(results, dict)
      output = results["stdout"].splitlines()[0]
      assert output == temp_dir_path
  
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 20 for calling a global function with example usage: test_environment(temp_dir_path) without return types