]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45354: Skip obsolete device name tests on Windows 11 (GH-28712)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 5 Oct 2021 12:39:18 +0000 (05:39 -0700)
committerGitHub <noreply@github.com>
Tue, 5 Oct 2021 12:39:18 +0000 (05:39 -0700)
(cherry picked from commit de4052fe0633e3a053e66c8477f13677054d6ede)

Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
Lib/test/test_winconsoleio.py

index a44f7bbd27b700917699f25062f40dd082a80e1d..7b2bfda339f95783a346d2027a8a220318872da4 100644 (file)
@@ -92,9 +92,11 @@ class WindowsConsoleIOTests(unittest.TestCase):
         f.close()
         f.close()
 
-        f = open('C:/con', 'rb', buffering=0)
-        self.assertIsInstance(f, ConIO)
-        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)
+            self.assertIsInstance(f, ConIO)
+            f.close()
 
     @unittest.skipIf(sys.getwindowsversion()[:2] <= (6, 1),
         "test does not work on Windows 7 and earlier")
@@ -114,7 +116,8 @@ class WindowsConsoleIOTests(unittest.TestCase):
         conout_path = os.path.join(temp_path, 'CONOUT$')
 
         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)
             else:
                 self.assertNotIsInstance(f, ConIO)