()
| 56 | |
| 57 | |
| 58 | def 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 | |
| 82 | def test_exec_command_stderr(): |
| 83 | # Test posix version: |
nothing calls this directly
no test coverage detected