def __init__(self): location = utils.get_lock_location() if location is None or location == '': raise ValueError( 'Redis server location must be set in the settings file.') self.redis_obj = Redis.from_url(location) self.storage_lock = self.redis_obj.lock( name=utils.get_lock_name(), timeout=utils.get_lock_time_to_live( ), # Time before lock is forcefully released. blocking_timeout=utils.get_lock_timeout(), )
def test_get_lock_name_default(): assert utils.get_lock_name() == 'testname'
def test_get_lock_name_default(): assert utils.get_lock_name() is 'MyLock'