Debian Codegraph @

tests/test_synchronizer.py

raw symbols SCIP
1 from beaker.synchronization import *
2
3 # TODO: spawn threads, test locking.
4
5
6 def teardown_module():
7 import shutil
8 shutil.rmtree('./cache', True)
9
10 def test_reentrant_file():
11 sync1 = file_synchronizer('test', lock_dir='./cache')
12 sync2 = file_synchronizer('test', lock_dir='./cache')
13 sync1.acquire_write_lock()
14 sync2.acquire_write_lock()
15 sync2.release_write_lock()
16 sync1.release_write_lock()
17
18 def test_null():
19 sync = null_synchronizer()
20 assert sync.acquire_write_lock()
21 sync.release_write_lock()
22
23 def test_mutex():
24 sync = mutex_synchronizer('someident')
25 sync.acquire_write_lock()
26 sync.release_write_lock()
27