summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2009-01-15 22:46:26 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2009-01-15 22:46:26 (GMT)
commit4f69b7e33be14ecec2ecb43a63d23662a9be81e1 (patch)
tree9555905b1b2c72f51859472585d634cd5fbe864c
parent71ba215d6bcb1cc5394bcc711e93845cc979c9d5 (diff)
downloadcpython-4f69b7e33be14ecec2ecb43a63d23662a9be81e1.zip
cpython-4f69b7e33be14ecec2ecb43a63d23662a9be81e1.tar.gz
cpython-4f69b7e33be14ecec2ecb43a63d23662a9be81e1.tar.bz2
Make all the invalid fd tests for os subject to the function being available.
-rw-r--r--Lib/test/test_os.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index aa7b591..88e4f62 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -547,13 +547,16 @@ class TestInvalidFD(unittest.TestCase):
locals()["test_"+f] = get_single(f)
def test_isatty(self):
- self.assertEqual(os.isatty(10), False)
+ if hasattr(os, "isatty"):
+ self.assertEqual(os.isatty(10), False)
def test_closerange(self):
- self.assertEqual(os.closerange(10, 20), None)
+ if hasattr(os, "closerange"):
+ self.assertEqual(os.closerange(10, 20), None)
def test_dup2(self):
- self.assertRaises(OSError, os.dup2, 10, 20)
+ if hasattr(os, "dup2"):
+ self.assertRaises(OSError, os.dup2, 10, 20)
def test_fchmod(self):
if hasattr(os, "fchmod"):
@@ -573,17 +576,20 @@ class TestInvalidFD(unittest.TestCase):
self.assertRaises(IOError, os.ftruncate, 10, 0)
def test_lseek(self):
- self.assertRaises(OSError, os.lseek, 10, 0, 0)
+ if hasattr(os, "lseek"):
+ self.assertRaises(OSError, os.lseek, 10, 0, 0)
def test_read(self):
- self.assertRaises(OSError, os.read, 10, 1)
+ if hasattr(os, "read"):
+ self.assertRaises(OSError, os.read, 10, 1)
def test_tcsetpgrpt(self):
if hasattr(os, "tcsetpgrp"):
self.assertRaises(OSError, os.tcsetpgrp, 10, 0)
def test_write(self):
- self.assertRaises(OSError, os.write, 10, " ")
+ if hasattr(os, "write"):
+ self.assertRaises(OSError, os.write, 10, " ")
if sys.platform != 'win32':
class Win32ErrorTests(unittest.TestCase):