Created
June 15, 2016 09:07
-
-
Save lfdversluis/3ce990fff513f38b673ad45b7e9aef43 to your computer and use it in GitHub Desktop.
Test does not raise on yield but "???" prints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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