Skip to content

Commit 63c9a6c

Browse files
bpo-45354: Skip obsolete device name tests on Windows 11 (GH-28712)
(cherry picked from commit de4052f) Co-authored-by: Jeremy Kloth <[email protected]>
1 parent 3ce5e07 commit 63c9a6c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Lib/test/test_winconsoleio.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ def test_open_name(self):
9292
f.close()
9393
f.close()
9494

95-
f = open('C:/con', 'rb', buffering=0)
96-
self.assertIsInstance(f, ConIO)
97-
f.close()
95+
# bpo-45354: Windows 11 changed MS-DOS device name handling
96+
if sys.getwindowsversion()[:3] < (10, 0, 22000):
97+
f = open('C:/con', 'rb', buffering=0)
98+
self.assertIsInstance(f, ConIO)
99+
f.close()
98100

99101
@unittest.skipIf(sys.getwindowsversion()[:2] <= (6, 1),
100102
"test does not work on Windows 7 and earlier")
@@ -114,7 +116,8 @@ def test_conout_path(self):
114116
conout_path = os.path.join(temp_path, 'CONOUT$')
115117

116118
with open(conout_path, 'wb', buffering=0) as f:
117-
if sys.getwindowsversion()[:2] > (6, 1):
119+
# bpo-45354: Windows 11 changed MS-DOS device name handling
120+
if (6, 1) < sys.getwindowsversion()[:3] < (10, 0, 22000):
118121
self.assertIsInstance(f, ConIO)
119122
else:
120123
self.assertNotIsInstance(f, ConIO)

0 commit comments

Comments
 (0)