summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_winconsoleio.py39
1 files changed, 21 insertions, 18 deletions
diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py
index 9e932fe..ea3a712 100644
--- a/Lib/test/test_winconsoleio.py
+++ b/Lib/test/test_winconsoleio.py
@@ -25,26 +25,29 @@ class WindowsConsoleIOTests(unittest.TestCase):
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")