diff options
author | Steve Dower <steve.dower@microsoft.com> | 2016-09-08 21:36:18 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2016-09-08 21:36:18 (GMT) |
commit | 33df0c3fb6c48a0434f407732d2a50102923db51 (patch) | |
tree | ca8695dd6c352a314349484579be4dade1bab28a | |
parent | f09e2fa2e93185a25cc0a0682784369d60f914e5 (diff) | |
download | cpython-33df0c3fb6c48a0434f407732d2a50102923db51.zip cpython-33df0c3fb6c48a0434f407732d2a50102923db51.tar.gz cpython-33df0c3fb6c48a0434f407732d2a50102923db51.tar.bz2 |
More lenient skipping of console tests.
-rw-r--r-- | Lib/test/test_winconsoleio.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py index ea3a712..ec26f06 100644 --- a/Lib/test/test_winconsoleio.py +++ b/Lib/test/test_winconsoleio.py @@ -25,24 +25,36 @@ class WindowsConsoleIOTests(unittest.TestCase): self.assertFalse(issubclass(ConIO, io.TextIOBase)) def test_open_fd(self): - if sys.stdin.fileno() == 0: + try: f = ConIO(0) + except ValueError: + # cannot open console because it's not a real console + pass + else: self.assertTrue(f.readable()) self.assertFalse(f.writable()) self.assertEqual(0, f.fileno()) f.close() # multiple close should not crash f.close() - if sys.stdout.fileno() == 1: + try: f = ConIO(1, 'w') + except ValueError: + # cannot open console because it's not a real console + pass + else: self.assertFalse(f.readable()) self.assertTrue(f.writable()) self.assertEqual(1, f.fileno()) f.close() f.close() - if sys.stderr.fileno() == 2: + try: f = ConIO(2, 'w') + except ValueError: + # cannot open console because it's not a real console + pass + else: self.assertFalse(f.readable()) self.assertTrue(f.writable()) self.assertEqual(2, f.fileno()) |