summaryrefslogtreecommitdiff
path: root/testtools/_deferreddebug.py
blob: 75da93d4c4d688d6b8605375d723b28cce199bdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright (c) testtools developers. See LICENSE for details.
#
# TODO: Move this to testtools.twistedsupport. See testing-cabal/testtools#202.

from fixtures import Fixture, MonkeyPatch


class DebugTwisted(Fixture):
    """Set debug options for Twisted."""

    def __init__(self, debug=True):
        super(DebugTwisted, self).__init__()
        self._debug_setting = debug

    def _setUp(self):
        self.useFixture(
            MonkeyPatch('twisted.internet.defer.Deferred.debug',
                        self._debug_setting))
        self.useFixture(
            MonkeyPatch('twisted.internet.base.DelayedCall.debug',
                        self._debug_setting))