Debugger exits abruptly with timeout error
Cannot attach debugger to unit test. The debugging session stops abrutply wit timeout error in about 5 seconds.
File "/Applications/PyCharm.app/helpers/pydev/pydevd_frame.py", line 34, in doWaitSuspend
self._args[0].doWaitSuspend(*args, **kwargs)
File "/Applications/PyCharm.app/helpers/pydev/pydevd.py", line 838, in doWaitSuspend
time.sleep(0.01)
File "/Users/swagle/Documents/workspace/ambari/ambari-server/src/test/python/TestAmbaryServer.py", line 1108, in signal_handler
self.fail("Timed out!")
AssertionError: Timed out!
File "/Applications/PyCharm.app/helpers/pydev/pydevd_frame.py", line 34, in doWaitSuspend
self._args[0].doWaitSuspend(*args, **kwargs)
File "/Applications/PyCharm.app/helpers/pydev/pydevd.py", line 838, in doWaitSuspend
time.sleep(0.01)
File "/Users/swagle/Documents/workspace/ambari/ambari-server/src/test/python/TestAmbaryServer.py", line 1108, in signal_handler
self.fail("Timed out!")
AssertionError: Timed out!
Please sign in to leave a comment.
"...TestAmbaryServer.py", line 1108, in signal_handler
Could you please attach the contents of the signal_handler function?
Thank you for responding. Here is the link to the unit test code,
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/python/TestAmbaryServer.py?view=markup&pathrev=1493290
The exception belongs to one of the unit tests, although it
Unit test with signal_handler:
@patch.object(ambari_server, "setup_db")
@patch.object(ambari_server, "print_info_msg")
@patch.object(ambari_server, "run_os_command")
@patch.object(ambari_server, "parse_properties_file")
@patch.object(ambari_server, "is_root")
def test_silent_reset(self, is_root_mock, parse_properties_file_mock,
run_os_command_mock, print_info_msg_mock,
setup_db_mock):
is_root_mock.return_value = True
args = MagicMock()
ambari_server.SILENT = True
self.assertTrue(ambari_server.SILENT)
run_os_command_mock.return_value = (0, None, None)
def signal_handler(signum, frame):
self.fail("Timed out!")
signal.signal(signal.SIGALRM, signal_handler)
signal.alarm(5)
rcode = ambari_server.reset(args)
self.assertEqual(None, rcode)
self.assertTrue(setup_db_mock.called)
Best Regard,
Sid
On Mon, Jun 17, 2013 at 3:44 AM, Dmitry Jemerov - PyCharm <
jetforum@jetbrains.com> wrote: