code: def test_exec_command_stdout():
      # Regression test for gh-2999 and gh-2915.
      # There are several packages (nose, scipy.weave.inline, Sage inline
      # Fortran) that replace stdout, in which case it doesn't have a fileno
      # method.  This is tested here, with a do-nothing command that fails if the
      # presence of fileno() is assumed in exec_command.
  
      # The code has a special case for posix systems, so if we are on posix test
      # both that the special case works and that the generic code works.
  
      # Test posix version:
      with redirect_stdout(StringIO()):
          with redirect_stderr(TemporaryFile()):
              with assert_warns(DeprecationWarning):
                  exec_command.exec_command("cd '.'")
  
      if os.name == "posix":
          # Test general (non-posix) version:
          with emulate_nonposix():
              with redirect_stdout(StringIO()):
                  with redirect_stderr(TemporaryFile()):
                      with assert_warns(DeprecationWarning):
                          exec_command.exec_command("cd '.'")
  
imports: import os
  import pytest
  import sys
  from tempfile import TemporaryFile
  from numpy.distutils import exec_command
  from numpy.distutils.exec_command import get_pythonexe
  from numpy.testing import tempdir, assert_, assert_warns, IS_WASM
  from io import StringIO
label_desc: Use image node_id 1 for calling a global function with example usage: test_exec_command_stdout() without return types