Message84004
Here's one:
class ReactorShutdownInteraction(unittest.TestCase):
"""Test reactor shutdown interaction"""
def setUp(self):
"""Start a UDP port"""
self.server = Server()
self.port = reactor.listenUDP(0, self.server, interface='127.0.0.1')
def tearDown(self):
"""Stop the UDP port"""
return self.port.stopListening()
Perhaps a feature like trial's `addCleanup´ should be added. This lets
you deal with cleanup in a somewhat simpler way. For example, rewriting
the above:
class ReactorShutdownInteraction(unittest.TestCase):
"""Test reactor shutdown interaction"""
def setUp(self):
"""Start a UDP port"""
self.server = Server()
self.port = reactor.listenUDP(0, self.server, interface='127.0.0.1')
# Stop the UDP port after the test completes.
self.addCleanup(self.port.stopListening) |
|
Date |
User |
Action |
Args |
2009-03-23 11:41:25 | exarkun | set | recipients:
+ exarkun, rhettinger, purcell, ngie |
2009-03-23 11:41:25 | exarkun | set | messageid: <1237808485.08.0.952624691101.issue5538@psf.upfronthosting.co.za> |
2009-03-23 11:41:19 | exarkun | link | issue5538 messages |
2009-03-23 11:41:19 | exarkun | create | |
|