~certify-web-dev/twisted/certify-trunk

« back to all changes in this revision

Viewing changes to twisted/trial/test/weird.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-17 14:52:35 UTC
  • mfrom: (1.1.5 upstream) (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20070117145235-btmig6qfmqfen0om
Tags: 2.5.0-0ubuntu1
New upstream version, compatible with python2.5.

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)