def test_with_block_locks(self):
        state['a'] = 123
        with tempfile.NamedTemporaryFile() as temp:
            def other_op():
                """Function to run in another process"""
                StateHandler.STATE_LOCK_TIMEOUT = 0.001
                other_handler = StateHandler(temp.name, load=True)

                self.assertRaises(RuntimeError,
                                  other_handler.__enter__)

            state.save(temp.name)
            state.reset_instance()
            with StateHandler(temp.name, load=True):
                process = multiprocessing.Process(target=other_op)
                process.start()
                process.join()
Test the with-block of the StateHandler locks the state
dataset/ETHPy150Open duerrp/pyexperiment/tests/test_state.py/TestStateHandler.test_with_block_locks