cpython: 4463e311f5bd (original) (raw)
Mercurial > cpython
changeset 106454:4463e311f5bd 3.6
Issue #28164: Improves test on Windows 7 [#28164]
Steve Dower steve.dower@microsoft.com | |
---|---|
date | Mon, 06 Feb 2017 14:50:17 -0800 |
parents | 9c325166ba5f |
children | 8132bcc1522d c3d779f96b20 |
files | Lib/test/test_winconsoleio.py |
diffstat | 1 files changed, 22 insertions(+), 16 deletions(-)[+] [-] Lib/test/test_winconsoleio.py 38 |
line wrap: on
line diff
--- a/Lib/test/test_winconsoleio.py +++ b/Lib/test/test_winconsoleio.py @@ -6,6 +6,7 @@ import os import sys import tempfile import unittest +from test import support if sys.platform != 'win32': raise unittest.SkipTest("test only relevant on win32") @@ -97,23 +98,28 @@ class WindowsConsoleIOTests(unittest.Tes self.assertIsInstance(f, ConIO) f.close()
try:[](#l1.15)
f = open(r'\\.\conin$', 'rb', buffering=0)[](#l1.16)
except FileNotFoundError:[](#l1.17)
# If we cannot find the file, this part should be skipped[](#l1.18)
print('\\\\.\\conin$ was not found on this OS')[](#l1.19)
else:[](#l1.20)
self.assertIsInstance(f, ConIO)[](#l1.21)
f.close()[](#l1.22)
- @unittest.skipIf(sys.getwindowsversion()[:2] <= (6, 1),
"test does not work on Windows 7 and earlier")[](#l1.24)
- def test_conin_conout_names(self):
f = open(r'\\.\conin$', 'rb', buffering=0)[](#l1.26)
self.assertIsInstance(f, ConIO)[](#l1.27)
f.close()[](#l1.28)
f = open('//?/conout$', 'wb', buffering=0)[](#l1.30)
self.assertIsInstance(f, ConIO)[](#l1.31)
f.close()[](#l1.32)
try:[](#l1.34)
f = open('//?/conout$', 'wb', buffering=0)[](#l1.35)
except FileNotFoundError:[](#l1.36)
# If we cannot find the file, this part should be skipped[](#l1.37)
print('//?/conout$ was not found on this OS')[](#l1.38)
else:[](#l1.39)
self.assertIsInstance(f, ConIO)[](#l1.40)
f.close()[](#l1.41)
- def test_conout_path(self):
temp_path = tempfile.mkdtemp()[](#l1.43)
self.addCleanup(support.rmtree, temp_path)[](#l1.44)
conout_path = os.path.join(temp_path, 'CONOUT$')[](#l1.46)
with open(conout_path, 'wb', buffering=0) as f:[](#l1.48)
if sys.getwindowsversion()[:2] > (6, 1):[](#l1.49)
self.assertIsInstance(f, ConIO)[](#l1.50)
else:[](#l1.51)
self.assertNotIsInstance(f, ConIO)[](#l1.52)
def assertStdinRoundTrip(self, text): stdin = open('CONIN$', 'r')