def test_other_process_locks(self):
        with tempfile.NamedTemporaryFile() as temp:
            def other_op(queue):
                """Lock the lockfile, then wait for poison pill
                """
                lockfile.FileLock(temp.name).acquire()
                while queue.empty():
                    sleep(0.01)
                lockfile.FileLock(temp.name).release()

            queue = multiprocessing.Queue()
            process = multiprocessing.Process(target=other_op,
                                              args=(queue,))
            process.start()

            while not lockfile.FileLock(temp.name).is_locked():
                sleep(0.01)
            StateHandler.STATE_LOCK_TIMEOUT = 0.001
            handler = StateHandler(temp.name, load=False)
            self.assertRaises(RuntimeError, handler.lock)
            queue.put(None)
            process.join()
Test locking the state in another process locks
dataset/ETHPy150Open duerrp/pyexperiment/tests/test_state.py/TestStateHandler.test_other_process_locks