File: _helpers.py

package info (click to toggle)
python-testtools 2.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,244 kB
  • sloc: python: 15,086; makefile: 127; sh: 3
file content (26 lines) | stat: -rw-r--r-- 528 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
22
23
24
25
26
# Copyright (c) 2010, 2016 testtools developers. See LICENSE for details.

__all__ = [
    "NeedsTwistedTestCase",
]

from typing import TYPE_CHECKING

from testtools import TestCase

if TYPE_CHECKING:
    from types import ModuleType

    defer: ModuleType | None
else:
    try:
        from twisted.internet import defer
    except ImportError:
        defer = None


class NeedsTwistedTestCase(TestCase):
    def setUp(self):
        super().setUp()
        if defer is None:
            self.skipTest("Need Twisted to run")