changeset 600:b2366bb97894 pytest2

added test_haveReadLock to TestWriteLock in test_lock - check if a readlock already exist
author pkumar <contactprashantat@gmail.com>
date Wed, 29 Jun 2011 12:12:45 +0530
parents e5c573426595
children f67e58bf2f3e
files MoinMoin/util/_tests/test_lock.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/util/_tests/test_lock.py	Wed Jun 29 11:46:30 2011 +0530
+++ b/MoinMoin/util/_tests/test_lock.py	Wed Jun 29 12:12:45 2011 +0530
@@ -137,6 +137,14 @@
         lock = WriteLock(self.lock_dir)
         assert lock.acquire(0.1)
 
+    def test_haveReadLocks(self):
+        """check if there is a ReadLock """
+        write_lock = WriteLock(self.lock_dir)
+        read_lock = ReadLock(self.lock_dir)
+        read_lock.acquire()
+        result = write_lock._haveReadLocks()
+        assert result, ('should return True but got False')
+    
 class TestReadLock(object):
     def setup_method(self, method):
         self.test_dir = tempfile.mkdtemp('', 'lock_')