|
4 | 4 | import unittest |
5 | 5 | from textwrap import dedent |
6 | 6 |
|
7 | | -from test.support import os_helper, requires_resource |
| 7 | +from test.support import os_helper, requires_resource, Py_DEBUG |
8 | 8 | from test.support.os_helper import TESTFN, TESTFN_ASCII |
9 | 9 |
|
10 | 10 | if sys.platform != "win32": |
@@ -115,6 +115,28 @@ def test_heap_min(self): |
115 | 115 | except OSError: |
116 | 116 | pass |
117 | 117 |
|
| 118 | + def test_GetErrorMode(self): |
| 119 | + msvcrt.GetErrorMode() |
| 120 | + |
| 121 | + def test_SetErrorMode(self): |
| 122 | + old = msvcrt.SetErrorMode(0) |
| 123 | + msvcrt.SetErrorMode(old) |
| 124 | + |
| 125 | + @unittest.skipUnless(Py_DEBUG, "only avialable under debug build") |
| 126 | + def test_set_error_mode(self): |
| 127 | + old = msvcrt.set_error_mode(msvcrt.OUT_TO_STDERR) |
| 128 | + msvcrt.set_error_mode(old) |
| 129 | + |
| 130 | + @unittest.skipUnless(Py_DEBUG, "only avialable under debug build") |
| 131 | + def test_CrtSetReportMode(self): |
| 132 | + old = msvcrt.CrtSetReportMode(msvcrt.CRT_WARN, msvcrt.CRTDBG_MODE_DEBUG) |
| 133 | + msvcrt.CrtSetReportMode(msvcrt.CRT_WARN, old) |
| 134 | + |
| 135 | + @unittest.skipUnless(Py_DEBUG, "only avialable under debug build") |
| 136 | + def test_CrtSetReportFile(self): |
| 137 | + old = msvcrt.CrtSetReportFile(msvcrt.CRT_WARN, sys.stdout.fileno()) |
| 138 | + msvcrt.CrtSetReportFile(msvcrt.CRT_WARN, old) |
| 139 | + |
118 | 140 |
|
119 | 141 | if __name__ == "__main__": |
120 | 142 | unittest.main() |
0 commit comments