[Python-checkins] cpython: Skips console open_fd tests when we don't have real consoles.
steve.dower
python-checkins at python.org
Thu Sep 8 17:34:40 EDT 2016
https://hg.python.org/cpython/rev/7a14822547db
changeset: 103360:7a14822547db
user: Steve Dower <steve.dower at microsoft.com>
date: Thu Sep 08 14:34:24 2016 -0700
summary:
Skips console open_fd tests when we don't have real consoles.
files:
Lib/test/test_winconsoleio.py | 39 ++++++++++++----------
1 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py
--- a/Lib/test/test_winconsoleio.py
+++ b/Lib/test/test_winconsoleio.py
@@ -25,26 +25,29 @@
self.assertFalse(issubclass(ConIO, io.TextIOBase))
def test_open_fd(self):
- f = ConIO(0)
- self.assertTrue(f.readable())
- self.assertFalse(f.writable())
- self.assertEqual(0, f.fileno())
- f.close() # multiple close should not crash
- f.close()
+ if sys.stdin.fileno() == 0:
+ f = ConIO(0)
+ self.assertTrue(f.readable())
+ self.assertFalse(f.writable())
+ self.assertEqual(0, f.fileno())
+ f.close() # multiple close should not crash
+ f.close()
- f = ConIO(1, 'w')
- self.assertFalse(f.readable())
- self.assertTrue(f.writable())
- self.assertEqual(1, f.fileno())
- f.close()
- f.close()
+ if sys.stdout.fileno() == 1:
+ f = ConIO(1, 'w')
+ self.assertFalse(f.readable())
+ self.assertTrue(f.writable())
+ self.assertEqual(1, f.fileno())
+ f.close()
+ f.close()
- f = ConIO(2, 'w')
- self.assertFalse(f.readable())
- self.assertTrue(f.writable())
- self.assertEqual(2, f.fileno())
- f.close()
- f.close()
+ if sys.stderr.fileno() == 2:
+ f = ConIO(2, 'w')
+ self.assertFalse(f.readable())
+ self.assertTrue(f.writable())
+ self.assertEqual(2, f.fileno())
+ f.close()
+ f.close()
def test_open_name(self):
f = ConIO("CON")
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list