gunicorn/tests/test_lockfile.py
benoitc 062b48d8d2 lockfile improvements
- rename LockFile.lock  to acquire
- rename LockFile.unlock to release
- move the lockfile management in sepate functions inside the arbiter
- remove the "closed" argument from the socket.close method and add a new "destroy" function that will be called whent  the socket can be unlinked (cal release)
- fix tests
2016-05-15 02:30:08 +02:00

16 lines
455 B
Python

import os
from gunicorn.lockfile import LockFile
from gunicorn.util import tmpfile
def test_lockfile():
lockname = tmpfile(prefix="gunicorn-tests", suffix=".lock")
lock_file = LockFile(lockname)
assert lock_file.released() == True
assert os.path.exists(lockname)
lock_file.acquire()
assert lock_file.released() == False
lock_file.release()
assert lock_file.released() == True
assert os.path.exists(lockname) == False