File: _deferreddebug.py

package info (click to toggle)
python-testtools 2.7.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,400 kB
  • sloc: python: 14,643; makefile: 126; sh: 3
file content (21 lines) | stat: -rw-r--r-- 627 bytes parent folder | download
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().__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)
        )