Debugging test hangs

If I run my complete test suite or if I run individually one test, it works ok: in no time I have my result back. However if I try to debug one test method, it hangs with "Instantiating test..." forever. The console does not provide any useful information to identify where it is hanging.
I would appreciate some pointer to find a way to properly debug why it is hanging (such as activating a more verbose output)

TIA,
Mariano
8 comments
Comment actions Permalink
Are you using Python 3?  If so, you might try with Python 2.7 and see if that helps.

If there is a way to add more verbose output, I don't know what it is. The command line it runs is printed in the first line of the console. You could try copying that to a terminal window and see what happens.  Is there any chance of a firewall blocking the localhost socket connection? I think the default port is 51308.
0
Comment actions Permalink
Thanks for the answer, I am running python 2.7

I have executed the process by prompt and it says:
$ /home/mariano/Code/p/env/bin/python /opt/pycharm/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 37309 --file /opt/pycharm/helpers/pycharm/utrunner.py /home/mariano/Code/p/code/satori/tests/test_alarms.py::AlarmTypesTests::test_get_valid_types true
Could not connect to 127.0.0.1: 37309
Traceback (most recent call last):
  File "/opt/pycharm/helpers/pydev/pydevd_comm.py", line 434, in StartClient
    s.connect((host, port))
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
prettyPrint();

However it exits immediately and via pycharm it hangs. Any idea why the connection could be refused? It is my personal machine and it has no firewall that I am aware of.
0
Comment actions Permalink
Did you try this after starting debugging on the PyCharm side?  It works for me (note: the port may be different every time) but then again I'm not having a hang launching it the normal way. I'm just wondering if it hangs before the script being debugging even connects to the debug server.
0
Comment actions Permalink
Not sure how to verify where it hangs because I have no useful logging to analyse. My major doubt is if something in my code is causing this or not.
0
Comment actions Permalink
Are you able to debug other Run Configurations like a regular Python script? Is your test set up in Run Configs as a regular Python script, or one of the Python test runners like Unittests or Nose? Have you played with the options under Settings -> Python Debugger?
0
Comment actions Permalink
Good idea. I need to inspect those options more closely (although I didn't touch them) and try several combinations to find out what is blocking. Unfortunately I ran out of time to do it right away but I will try as soon as I have some available time.

thanks for the followup.
0
Comment actions Permalink
Having the same problem, wrote a simple Hello world program and getting:

Connected to pydev debugger (build 135.1057)
pydev debugger: starting


Process finished with exit code 137
0
Comment actions Permalink
A little late, but I just ran into the same problem.  Turn off Break on all exceptions when raised.  That made it go away.  The unittest framework seems to use exceptions as control structures down below.  Starts just fine if you turn off "Activation Policy On Raise".
3

Please sign in to leave a comment.