summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJP <jpellerin@gmail.com>2012-09-03 06:04:16 -0700
committerJP <jpellerin@gmail.com>2012-09-03 06:04:16 -0700
commitfb9690d46ecec6ab160e315e5d481cc1cd286595 (patch)
tree5d28bde46990bd3385dad50664bb07fa67fa87a7
parent663587690a4aaf43e8bcf4c5a7a8820e1fedafee (diff)
parentcb4bea4dfee798cb69c8602403c5b1c796e5594d (diff)
downloadnose-fb9690d46ecec6ab160e315e5d481cc1cd286595.tar.gz
Merge pull request #521 from chevah/301-twisted-reactor-stop-hang
#301 - Call reactor.stop from twisted thread.
-rw-r--r--nose/twistedtools.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/nose/twistedtools.py b/nose/twistedtools.py
index 3720610..8d9c6ff 100644
--- a/nose/twistedtools.py
+++ b/nose/twistedtools.py
@@ -70,7 +70,12 @@ def stop_reactor():
you mix tests using these tools and tests using twisted.trial.
"""
global _twisted_thread
- reactor.stop()
+
+ def stop_reactor():
+ '''Helper for calling stop from withing the thread.'''
+ reactor.stop()
+
+ reactor.callFromThread(stop_reactor)
reactor_thread.join()
for p in reactor.getDelayedCalls():
if p.active():