File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 33import itertools
44import signal
55import sys
6+ import threading
67import warnings
78
89import decorator
@@ -200,7 +201,16 @@ def init_twisted_greenlet():
200201 return
201202
202203 if not _instances .reactor .running :
203- if signal .getsignal (signal .SIGINT ) == signal .default_int_handler :
204+ if not isinstance (threading .current_thread (), threading ._MainThread ):
205+ warnings .warn (
206+ (
207+ 'Will not attempt to block Twisted signal configuration'
208+ ' since we are not running in the main thread. See'
209+ ' https://github.com/pytest-dev/pytest-twisted/issues/153.'
210+ ),
211+ RuntimeWarning ,
212+ )
213+ elif signal .getsignal (signal .SIGINT ) == signal .default_int_handler :
204214 signal .signal (
205215 signal .SIGINT ,
206216 functools .partial (signal .default_int_handler ),
You can’t perform that action at this time.
0 commit comments