Changeset 391 for python/trunk/Lib/test/test_fcntl.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/test/test_fcntl.py
r2 r391 4 4 5 5 """ 6 import fcntl7 6 import os 8 7 import struct 9 8 import sys 9 import _testcapi 10 10 import unittest 11 from test.test_support import verbose, TESTFN, unlink, run_unittest 11 from test.test_support import (verbose, TESTFN, unlink, run_unittest, 12 import_module) 13 14 # Skip test if no fcntl module. 15 fcntl = import_module('fcntl') 16 12 17 13 18 # TODO - Write tests for flock() and lockf(). … … 24 29 start_len = "qq" 25 30 26 if sys.platform in ('netbsd1', 'netbsd2', 'netbsd3', 27 'Darwin1.2', 'darwin', 28 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5', 29 'freebsd6', 'freebsd7', 'freebsd8', 30 'bsdos2', 'bsdos3', 'bsdos4', 31 'openbsd', 'openbsd2', 'openbsd3', 'openbsd4'): 31 if (sys.platform.startswith(('netbsd', 'freebsd', 'openbsd', 'bsdos')) 32 or sys.platform == 'darwin'): 32 33 if struct.calcsize('l') == 8: 33 34 off_t = 'l' … … 82 83 self.f.close() 83 84 85 def test_fcntl_bad_file(self): 86 class F: 87 def __init__(self, fn): 88 self.fn = fn 89 def fileno(self): 90 return self.fn 91 self.assertRaises(ValueError, fcntl.fcntl, -1, fcntl.F_SETFL, os.O_NONBLOCK) 92 self.assertRaises(ValueError, fcntl.fcntl, F(-1), fcntl.F_SETFL, os.O_NONBLOCK) 93 self.assertRaises(TypeError, fcntl.fcntl, 'spam', fcntl.F_SETFL, os.O_NONBLOCK) 94 self.assertRaises(TypeError, fcntl.fcntl, F('spam'), fcntl.F_SETFL, os.O_NONBLOCK) 95 # Issue 15989 96 self.assertRaises(ValueError, fcntl.fcntl, _testcapi.INT_MAX + 1, 97 fcntl.F_SETFL, os.O_NONBLOCK) 98 self.assertRaises(ValueError, fcntl.fcntl, F(_testcapi.INT_MAX + 1), 99 fcntl.F_SETFL, os.O_NONBLOCK) 100 self.assertRaises(ValueError, fcntl.fcntl, _testcapi.INT_MIN - 1, 101 fcntl.F_SETFL, os.O_NONBLOCK) 102 self.assertRaises(ValueError, fcntl.fcntl, F(_testcapi.INT_MIN - 1), 103 fcntl.F_SETFL, os.O_NONBLOCK) 104 84 105 def test_fcntl_64_bit(self): 85 106 # Issue #1309352: fcntl shouldn't fail when the third arg fits in a … … 90 111 flags = fcntl.DN_MULTISHOT 91 112 except AttributeError: 92 # F_NOTIFY or DN_MULTISHOT unavailable, skipping 93 return 113 self.skipTest("F_NOTIFY or DN_MULTISHOT unavailable") 94 114 fd = os.open(os.path.dirname(os.path.abspath(TESTFN)), os.O_RDONLY) 95 115 try:
Note:
See TracChangeset
for help on using the changeset viewer.