Kaydet (Commit) 4f69b7e3 authored tarafından Kristján Valur Jónsson's avatar Kristján Valur Jónsson

Make all the invalid fd tests for os subject to the function being available.

üst 71ba215d
......@@ -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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment