Skip to content

gh-126028: Add more tests for msvcrt module #126029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Next Next commit
Add more tests for msvcrt module
  • Loading branch information
aisk committed Oct 27, 2024
commit 71d7cc7d8f24fbb5b51b47b4f0133de701e7bd9b
24 changes: 23 additions & 1 deletion Lib/test/test_msvcrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import unittest
from textwrap import dedent

from test.support import os_helper, requires_resource
from test.support import os_helper, requires_resource, Py_DEBUG
from test.support.os_helper import TESTFN, TESTFN_ASCII

if sys.platform != "win32":
Expand Down Expand Up @@ -115,6 +115,28 @@ def test_heap_min(self):
except OSError:
pass

def test_GetErrorMode(self):
msvcrt.GetErrorMode()

def test_SetErrorMode(self):
old = msvcrt.SetErrorMode(0)
msvcrt.SetErrorMode(old)

@unittest.skipUnless(Py_DEBUG, "only avialable under debug build")
def test_set_error_mode(self):
old = msvcrt.set_error_mode(msvcrt.OUT_TO_STDERR)
msvcrt.set_error_mode(old)

@unittest.skipUnless(Py_DEBUG, "only avialable under debug build")
def test_CrtSetReportMode(self):
old = msvcrt.CrtSetReportMode(msvcrt.CRT_WARN, msvcrt.CRTDBG_MODE_DEBUG)
msvcrt.CrtSetReportMode(msvcrt.CRT_WARN, old)

@unittest.skipUnless(Py_DEBUG, "only avialable under debug build")
def test_CrtSetReportFile(self):
old = msvcrt.CrtSetReportFile(msvcrt.CRT_WARN, sys.stdout.fileno())
msvcrt.CrtSetReportFile(msvcrt.CRT_WARN, old)


if __name__ == "__main__":
unittest.main()
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy