~hudson-openstack/nova/trunk

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/twisted/trial/test/weird.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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)