Jean-Paul Calderone <exar...@divmod.com> added the comment: 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) ---------- nosy: +exarkun _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5538> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com