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

« back to all changes in this revision

Viewing changes to twisted/trial/util.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:
21
21
 
22
22
import traceback, gc, sys
23
23
from twisted.python import log, threadpool
24
 
from twisted.internet import interfaces
 
24
from twisted.internet import interfaces, utils
25
25
 
26
26
# Methods in this list will be omitted from a failed test's traceback if
27
27
# they are the final frame.
61
61
    cleanPending = cleanThreads = cleanReactor = True
62
62
 
63
63
    def postCaseCleanup(self):
64
 
        return self._dispatch('logErrCheck', 'cleanPending')
 
64
        return self._dispatch('cleanPending')
65
65
 
66
66
    def postClassCleanup(self):
67
 
        return self._dispatch('logErrCheck', 'cleanReactor',
 
67
        return self._dispatch('cleanReactor',
68
68
                              'cleanPending', 'cleanThreads')
69
69
 
70
70
    def _dispatch(self, *attrs):
71
71
        for attr in attrs:
72
72
            getattr(self, "do_%s" % attr)()
73
73
 
74
 
    def do_logErrCheck(cls):
75
 
        try:
76
 
            if len(log._keptErrors) > 0:
77
 
                raise FailureError(log._keptErrors[0])
78
 
        finally:
79
 
            log.flushErrors()
80
 
    do_logErrCheck = classmethod(do_logErrCheck)
81
 
 
82
74
    def do_cleanPending(cls):
83
75
        # don't import reactor when module is loaded
84
76
        from twisted.internet import reactor
97
89
                else:
98
90
                    print "WEIRNESS! pending timed call not active+!"
99
91
            raise PendingTimedCallsError(s)
 
92
    do_cleanPending = utils.suppressWarnings(
 
93
        do_cleanPending, (('ignore',), {'category': DeprecationWarning,
 
94
                                        'message':
 
95
                                        r'reactor\.iterate cannot be used.*'}))
100
96
    do_cleanPending = classmethod(do_cleanPending)
101
97
 
 
98
 
102
99
    def do_cleanThreads(cls):
103
100
        from twisted.internet import reactor
104
101
        if interfaces.IReactorThreads.providedBy(reactor):