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

zooba webhook-mailer at python.org
Tue Oct 5 08:17:21 EDT 2021


https://github.com/python/cpython/commit/de4052fe0633e3a053e66c8477f13677054d6ede
commit: de4052fe0633e3a053e66c8477f13677054d6ede
branch: main
author: Jeremy Kloth <jeremy.kloth at gmail.com>
committer: zooba <steve.dower at microsoft.com>
date: 2021-10-05T13:17:13+01:00
summary:

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

files:
M Lib/test/test_winconsoleio.py

diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py
index 1807e47c66c38..70a85552cc03b 100644
--- a/Lib/test/test_winconsoleio.py
+++ b/Lib/test/test_winconsoleio.py
@@ -92,9 +92,11 @@ def test_open_name(self):
         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 @@ def test_conout_path(self):
         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)



More information about the Python-checkins mailing list