Re: [nose-users] nose hanging at the end of tests

806 views
Skip to first unread message

prasanna

unread,
Apr 23, 2013, 12:15:10 AM4/23/13
to nose-...@googlegroups.com
On 22 April 2013 22:58, Kelsey Prantis <krw...@gmail.com> wrote:
> Hi Folks,
>
> I am hoping I could perhaps get some advice on troubleshooting a problem I
> am having using nose.
>
> I have a directory of tests I am running with nose, and it goes ahead and
> runs all of the tests just fine, and reports the results (stacktraces, the
> summary of passed, failed, errored, etc), but then just hangs and never
> exits, with no additional output. I've let it hang as long as 17 hours. I
> can do a ps -ef | grep nose and see that the process for running the tests
> is still running.
>
> Frankly, I have no idea where to go from here. Since our tests themselves
> have completed executing, I'm not sure where a problem is even occurring. In
> nose itself? In some thread started by nose that can't be stopped or
> something? I could use some tips on how to dig into what is even happening.
> Is it possible to get nose to output some kind of debug information itself
> about what it is doing?
>
> Details:
> - nose version 1.2.1
> - plugins in use: django-nose, nose-testconfig==0.8
> - nose command: nosetests --verbosity=2 --tc-file=path/to/some.json
> --tc-format=json --with-xunit --xunit-file /path/to/tests
>
> It doesn't actually even happen every time, just sporadically.
>
> Any advice is appreciated,
>
> Kelsey
>

nose does support debug output using the -l option. So you'd have to
do something like:
$ nosetests --verbosity=2 --tc-file=path/to/some.json --tc-format=json
--with-xunit --xunit-file /path/to/tests -l <nose.debug.module>

Where the debug module is something you can isolate as described in the docs:
-l DEBUG, --debug=DEBUG
Activate debug logging for one or more systems.
Available debug loggers: nose, nose.importer,
nose.inspector, nose.plugins, nose.result and
nose.selector. Separate multiple names with a comma.

I don't use the django-nose plugin myself so if it's something plugin
specific I'd enable logging at logger: nose.plugins and see what's
going wrong.

Kelsey Prantis

unread,
Apr 23, 2013, 12:30:36 PM4/23/13
to nose-...@googlegroups.com, t...@apache.org
Fantastic! This is just what I needed to be able to gather more information to troubleshoot, thank you. Will report back if I find anything interesting!

Kelsey

Kelsey Prantis

unread,
May 6, 2013, 3:16:06 PM5/6/13
to nose-...@googlegroups.com, t...@apache.org
On Tuesday, April 23, 2013 10:30:36 AM UTC-6, Kelsey Prantis wrote:
Fantastic! This is just what I needed to be able to gather more information to troubleshoot, thank you. Will report back if I find anything interesting!

Kelsey

Ok, so I've done some more research into what is going on. Basically, our test code is spawning some threads that are never exiting properly. Obviously, that is a bug in our test code that needs fixing, but I am also wondering if there is something we can do to protect our tests from hanging indefinitely if a test misbehaves and leaves threads running - some point where it just shuts everything down forcefully. (The equivalent of Ctrl-Cing it even would be fine). I've tried playing with things like tearDownPackage to detect these extra threads and exit (using os._exit), but then that gets called actually before results are recorded, and then we can't see any of the results from the test run. (Whereas if we externally Ctrl-C the process by hand once it hangs, we did at least still get our results recorded). Ideally, we'd like to just print some sort of error so we know we need to fix hanging threads, but still be able to record results, without manual intervention. Is there any hook into nose where we can perform an action *after* results have all been recorded? Or is the only option some sort of custom nose plugin here?

Kelsey
Reply all
Reply to author
Forward
0 new messages