bpo-45354: Skip obsolete device name tests on Windows 11 (GH-28712)

(cherry picked from commit de4052fe06)

Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
This commit is contained in:
Miss Islington (bot) 2021-10-05 05:39:18 -07:00 committed by GitHub
parent 3ce5e07e9a
commit 63c9a6cc8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,6 +92,8 @@ class WindowsConsoleIOTests(unittest.TestCase):
f.close() f.close()
f.close() f.close()
# bpo-45354: Windows 11 changed MS-DOS device name handling
if sys.getwindowsversion()[:3] < (10, 0, 22000):
f = open('C:/con', 'rb', buffering=0) f = open('C:/con', 'rb', buffering=0)
self.assertIsInstance(f, ConIO) self.assertIsInstance(f, ConIO)
f.close() f.close()
@ -114,7 +116,8 @@ class WindowsConsoleIOTests(unittest.TestCase):
conout_path = os.path.join(temp_path, 'CONOUT$') conout_path = os.path.join(temp_path, 'CONOUT$')
with open(conout_path, 'wb', buffering=0) as f: with open(conout_path, 'wb', buffering=0) as f:
if sys.getwindowsversion()[:2] > (6, 1): # bpo-45354: Windows 11 changed MS-DOS device name handling
if (6, 1) < sys.getwindowsversion()[:3] < (10, 0, 22000):
self.assertIsInstance(f, ConIO) self.assertIsInstance(f, ConIO)
else: else:
self.assertNotIsInstance(f, ConIO) self.assertNotIsInstance(f, ConIO)