Skip to content

Instantly share code, notes, and snippets.

@lfdversluis
Created June 15, 2016 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lfdversluis/3ce990fff513f38b673ad45b7e9aef43 to your computer and use it in GitHub Desktop.
Save lfdversluis/3ce990fff513f38b673ad45b7e9aef43 to your computer and use it in GitHub Desktop.
Test does not raise on yield but "???" prints
from unittest import TestCase
from nose.tools import raises
from nose.twistedtools import reactor
from twisted.internet.defer import inlineCallbacks
from twisted.internet.threads import blockingCallFromThread
class TestExample(TestCase):
@inlineCallbacks
@raises(RuntimeError)
def test_raise(self):
def raiseError():
raise RuntimeError()
def crash():
print "test"
yield raiseError()
try:
bla = yield blockingCallFromThread(reactor, crash)
bla.next()
except RuntimeError:
print "???"
raise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment