changeset 599:e5c573426595 pytest2

TestReadLock added for lock.ReadLock in util.test_lock
author pkumar <contactprashantat@gmail.com>
date Wed, 29 Jun 2011 11:46:30 +0530
parents af0b6a1c3764
children b2366bb97894
files MoinMoin/util/_tests/test_lock.py
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/util/_tests/test_lock.py	Wed Jun 29 02:58:23 2011 +0530
+++ b/MoinMoin/util/_tests/test_lock.py	Wed Jun 29 11:46:30 2011 +0530
@@ -11,7 +11,7 @@
 
 import pytest
 
-from MoinMoin.util.lock import ExclusiveLock, WriteLock
+from MoinMoin.util.lock import ExclusiveLock, WriteLock, ReadLock
 
 
 class TestExclusiveLock(object):
@@ -135,7 +135,19 @@
     def test_writelock_acquire(self):
         """ util.lock: WriteLock: acquire """
         lock = WriteLock(self.lock_dir)
-        pytest.set_trace()
+        assert lock.acquire(0.1)
+
+class TestReadLock(object):
+    def setup_method(self, method):
+        self.test_dir = tempfile.mkdtemp('', 'lock_')
+        self.lock_dir = os.path.join(self.test_dir, "readlock")
+
+    def teardown_method(self, method):
+        shutil.rmtree(self.test_dir)
+    
+    def test_readlock_acquire(self):
+        """ util.lock: ReadLock: acquire """
+        lock = ReadLock(self.lock_dir)
         assert lock.acquire(0.1)
 
 coverage_modules = ['MoinMoin.util.lock']