From 030bf739315721b433eba01419d1447125fe1e32 Mon Sep 17 00:00:00 2001 From: Jeremy Kloth Date: Sun, 3 Oct 2021 11:42:08 -0600 Subject: [PATCH 1/2] Skip tests made obsolete by more strict device name handling in Windows 11 --- Lib/test/test_winconsoleio.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py index 1807e47c66c387..c40c5de663f623 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() + # 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): + # 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) From 2619eab7b3a433a951da69199d4c3f90d567d618 Mon Sep 17 00:00:00 2001 From: Jeremy Kloth Date: Mon, 4 Oct 2021 09:07:50 -0600 Subject: [PATCH 2/2] Reference issue in comments --- Lib/test/test_winconsoleio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py index c40c5de663f623..70a85552cc03b0 100644 --- a/Lib/test/test_winconsoleio.py +++ b/Lib/test/test_winconsoleio.py @@ -92,7 +92,7 @@ def test_open_name(self): f.close() f.close() - # Windows 11 changed MS-DOS device name handling + # 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) @@ -116,7 +116,7 @@ def test_conout_path(self): conout_path = os.path.join(temp_path, 'CONOUT$') with open(conout_path, 'wb', buffering=0) as f: - # Windows 11 changed MS-DOS device name handling + # bpo-45354: Windows 11 changed MS-DOS device name handling if (6, 1) < sys.getwindowsversion()[:3] < (10, 0, 22000): self.assertIsInstance(f, ConIO) else: