Finish the test

This commit is contained in:
Maciej Fijalkowski 2010-11-24 15:06:40 +02:00
parent 233baecd2d
commit ff27d299cc
1 changed files with 11 additions and 5 deletions

View File

@ -228,7 +228,7 @@ class TestTrialUnittest:
def test_trial_error(self, testdir): def test_trial_error(self, testdir):
testdir.makepyfile(""" testdir.makepyfile("""
from twisted.trial.unittest import TestCase from twisted.trial.unittest import TestCase
from twisted.internet.defer import inlineCallbacks from twisted.internet.defer import Deferred
from twisted.internet import reactor from twisted.internet import reactor
class TC(TestCase): class TC(TestCase):
@ -238,13 +238,16 @@ class TestTrialUnittest:
def test_two(self): def test_two(self):
def f(_): def f(_):
crash crash
return reactor.callLater(0.3, f) d = Deferred()
d.addCallback(f)
reactor.callLater(0.3, d.callback, None)
return d
def test_three(self): def test_three(self):
def f(): def f():
pass # will never get called pass # will never get called
return reactor.callLater(0.3, f) reactor.callLater(0.3, f)
# will crash at teardown # will crash at teardown
def test_four(self): def test_four(self):
@ -252,7 +255,10 @@ class TestTrialUnittest:
reactor.callLater(0.3, f) reactor.callLater(0.3, f)
crash crash
return reactor.callLater(0.3, f) d = Deferred()
d.addCallback(f)
reactor.callLater(0.3, d.callback, None)
return d
# will crash both at test time and at teardown # will crash both at test time and at teardown
""") """)
result = testdir.runpytest() result = testdir.runpytest()