[Python-checkins] python/dist/src/Lib/test test_posix.py,1.7,1.8

montanaro@users.sourceforge.net montanaro at users.sourceforge.net
Fri Jun 17 03:14:53 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv365
Modified Files:
	test_posix.py 
Log Message:
Add tests for posix O_SHLOCK & O_EXLOCK. Missed checking this in with
posixmodule.c 2.335. Really should be considered part of patch #1103951.
Index: test_posix.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_posix.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- test_posix.py	6 Jun 2004 20:27:05 -0000	1.7
+++ test_posix.py	17 Jun 2005 01:14:49 -0000	1.8
@@ -94,6 +94,37 @@
 self.fdopen_helper('r')
 self.fdopen_helper('r', 100)
 
+ def test_osexlock(self):
+ if hasattr(posix, "O_EXLOCK"):
+ fd = os.open(test_support.TESTFN,
+ os.O_WRONLY|os.O_EXLOCK|os.O_CREAT)
+ self.assertRaises(OSError, os.open, test_support.TESTFN,
+ os.O_WRONLY|os.O_EXLOCK|os.O_NONBLOCK)
+ os.close(fd)
+
+ if hasattr(posix, "O_SHLOCK"):
+ fd = os.open(test_support.TESTFN,
+ os.O_WRONLY|os.O_SHLOCK|os.O_CREAT)
+ self.assertRaises(OSError, os.open, test_support.TESTFN,
+ os.O_WRONLY|os.O_EXLOCK|os.O_NONBLOCK)
+ os.close(fd)
+
+ def test_osshlock(self):
+ if hasattr(posix, "O_SHLOCK"):
+ fd1 = os.open(test_support.TESTFN,
+ os.O_WRONLY|os.O_SHLOCK|os.O_CREAT)
+ fd2 = os.open(test_support.TESTFN,
+ os.O_WRONLY|os.O_SHLOCK|os.O_CREAT)
+ os.close(fd2)
+ os.close(fd1)
+
+ if hasattr(posix, "O_EXLOCK"):
+ fd = os.open(test_support.TESTFN,
+ os.O_WRONLY|os.O_SHLOCK|os.O_CREAT)
+ self.assertRaises(OSError, os.open, test_support.TESTFN,
+ os.O_RDONLY|os.O_EXLOCK|os.O_NONBLOCK)
+ os.close(fd)
+
 def test_fstat(self):
 if hasattr(posix, 'fstat'):
 fp = open(test_support.TESTFN)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /