def test_concurrent_input_without_check(self, input_mock, output_mock):
        input_mock.side_effect = self._wait_for_concurrent_call

        h = InputHandler()
        h2 = InputHandler()
        h.set_callback(self._test_callback)
        h2.set_callback(self._test_callback2)
        h2.skip_concurrency_check = True
        h.skip_concurrency_check = True

        h.get_input(Prompt(message="ABC"))
        self._thread_event_wait_for_inner.wait()
        h2.get_input(Prompt(message="ABC"))
        self._thread_event_wait_for_outer.set()

        h.wait_on_input()
        h2.wait_on_input()

        self.assertFalse(self._callback_called)
        self.assertFalse(h.input_successful())

        self.assertTrue(self._callback_called2)
        self.assertTrue(h2.input_successful())
        self.assertEqual(self._callback_input2, "thread 0")
        self.assertEqual(h2.value, "thread 0")
Exemple #2
0
 def _get_meh_input_func(self, text_prompt):
     handler = InputHandler(source=self.meh_interface)
     handler.skip_concurrency_check = True
     handler.get_input(text_prompt)
     handler.wait_on_input()
     return handler.value
Exemple #3
0
 def _get_meh_input_func(self, text_prompt):
     handler = InputHandler(source=self.meh_interface)
     handler.skip_concurrency_check = True
     handler.get_input(text_prompt)
     handler.wait_on_input()
     return handler.value