Initial import to Tizen
[profile/ivi/python-twisted.git] / twisted / trial / test / weird.py
1 from twisted.trial import unittest
2 from twisted.internet import defer
3
4 # Used in test_tests.TestUnhandledDeferred
5
6 class TestBleeding(unittest.TestCase):
7     """This test creates an unhandled Deferred and leaves it in a cycle.
8     
9     The Deferred is left in a cycle so that the garbage collector won't pick it
10     up immediately.  We were having some problems where unhandled Deferreds in
11     one test were failing random other tests. (See #1507, #1213)
12     """
13     def test_unhandledDeferred(self):
14         try:
15             1/0
16         except ZeroDivisionError:
17             f = defer.fail()
18         # these two lines create the cycle. don't remove them
19         l = [f]
20         l.append(l)