Skip to content

Commit c2c596b

Browse files
authored
Merge pull request #137 from yaccz/fix-sigint
2 parents 5dc4efc + 36cb789 commit c2c596b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pytest_twisted.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,12 @@ def init_twisted_greenlet():
208208

209209
def stop_twisted_greenlet():
210210
if _instances.gr_twisted:
211-
_instances.reactor.stop()
211+
try:
212+
_instances.reactor.stop()
213+
except error.ReactorNotRunning:
214+
# Sometimes the reactor is stopped before we get here. For
215+
# example, this can happen in response to a SIGINT in some cases.
216+
pass
212217
_instances.gr_twisted.switch()
213218

214219

0 commit comments

Comments
 (0)