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 3
3
import itertools
4
4
import signal
5
5
import sys
6
+ import threading
6
7
import warnings
7
8
8
9
import decorator
@@ -200,7 +201,16 @@ def init_twisted_greenlet():
200
201
return
201
202
202
203
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 :
204
214
signal .signal (
205
215
signal .SIGINT ,
206
216
functools .partial (signal .default_int_handler ),
You can’t perform that action at this time.
0 commit comments