changeset 598:af0b6a1c3764 pytest2

added class TestWrilteLock for lock.WriteLock in util/test_lock.py
author pkumar <contactprashantat@gmail.com>
date Wed, 29 Jun 2011 02:58:23 +0530
parents c86e1f677ebc
children e5c573426595
files MoinMoin/util/_tests/test_lock.py
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/util/_tests/test_lock.py	Wed Jun 29 01:07:58 2011 +0530
+++ b/MoinMoin/util/_tests/test_lock.py	Wed Jun 29 02:58:23 2011 +0530
@@ -11,7 +11,7 @@
 
 import pytest
 
-from MoinMoin.util.lock import ExclusiveLock
+from MoinMoin.util.lock import ExclusiveLock, WriteLock
 
 
 class TestExclusiveLock(object):
@@ -124,5 +124,19 @@
         time.sleep(delay)
         lock.release()
 
+class TestWriteLock(object):
+    def setup_method(self, method):
+        self.test_dir = tempfile.mkdtemp('', 'lock_')
+        self.lock_dir = os.path.join(self.test_dir, "writelock")
+
+    def teardown_method(self, method):
+        shutil.rmtree(self.test_dir)
+    
+    def test_writelock_acquire(self):
+        """ util.lock: WriteLock: acquire """
+        lock = WriteLock(self.lock_dir)
+        pytest.set_trace()
+        assert lock.acquire(0.1)
+
 coverage_modules = ['MoinMoin.util.lock']