MCPcopy Create free account
hub / github.com/numpy/numpy / test_exec_command_stdout

Function test_exec_command_stdout

numpy/distutils/tests/test_exec_command.py:58–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56
57
58def test_exec_command_stdout():
59 # Regression test for gh-2999 and gh-2915.
60 # There are several packages (nose, scipy.weave.inline, Sage inline
61 # Fortran) that replace stdout, in which case it doesn't have a fileno
62 # method. This is tested here, with a do-nothing command that fails if the
63 # presence of fileno() is assumed in exec_command.
64
65 # The code has a special case for posix systems, so if we are on posix test
66 # both that the special case works and that the generic code works.
67
68 # Test posix version:
69 with redirect_stdout(StringIO()):
70 with redirect_stderr(TemporaryFile()):
71 with assert_warns(DeprecationWarning):
72 exec_command.exec_command("cd '.'")
73
74 if os.name == 'posix':
75 # Test general (non-posix) version:
76 with emulate_nonposix():
77 with redirect_stdout(StringIO()):
78 with redirect_stderr(TemporaryFile()):
79 with assert_warns(DeprecationWarning):
80 exec_command.exec_command("cd '.'")
81
82def test_exec_command_stderr():
83 # Test posix version:

Callers

nothing calls this directly

Calls 4

assert_warnsFunction · 0.90
redirect_stdoutClass · 0.85
redirect_stderrClass · 0.85
emulate_nonposixClass · 0.85

Tested by

no test coverage detected