Imported Upstream version 12.1.0
[contrib/python-twisted.git] / twisted / internet / test / test_qtreactor.py
1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 import sys
5
6 from twisted.trial import unittest
7 from twisted.python.runtime import platform
8 from twisted.python.util import sibpath
9 from twisted.internet.utils import getProcessOutputAndValue
10
11
12 skipWindowsNopywin32 = None
13 if platform.isWindows():
14     try:
15         import win32process
16     except ImportError:
17         skipWindowsNopywin32 = ("On windows, spawnProcess is not available "
18                                 "in the absence of win32process.")
19
20 class QtreactorTestCase(unittest.TestCase):
21     """
22     Tests for L{twisted.internet.qtreactor}.
23     """
24     def test_importQtreactor(self):
25         """
26         Attempting to import L{twisted.internet.qtreactor} should raise an
27         C{ImportError} indicating that C{qtreactor} is no longer a part of
28         Twisted.
29         """
30         sys.modules["qtreactor"] = None
31         from twisted.plugins.twisted_qtstub import errorMessage
32         try:
33             import twisted.internet.qtreactor
34         except ImportError, e:
35             self.assertEqual(str(e), errorMessage)