diff --git a/twisted/python/runtime.py b/twisted/python/runtime.py
index da078bf..5fa2ea6 100644
|
a
|
b
|
|
| 9 | 9 | import time |
| 10 | 10 | import imp |
| 11 | 11 | |
| | 12 | from twisted.python import compat |
| | 13 | |
| 12 | 14 | |
| 13 | 15 | |
| 14 | 16 | def shortPythonVersion(): |
| … |
… |
|
| 73 | 75 | def isWinNT(self): |
| 74 | 76 | """Are we running in Windows NT?""" |
| 75 | 77 | if self.getType() == 'win32': |
| 76 | | import _winreg |
| | 78 | # Python 3.x changed this module's name. |
| | 79 | winreg = None |
| | 80 | if compat._PY3: |
| | 81 | import winreg as winreg |
| | 82 | else: |
| | 83 | import _winreg as winreg |
| 77 | 84 | try: |
| 78 | | k = _winreg.OpenKeyEx( |
| 79 | | _winreg.HKEY_LOCAL_MACHINE, |
| | 85 | k = winreg.OpenKeyEx( |
| | 86 | winreg.HKEY_LOCAL_MACHINE, |
| 80 | 87 | r'Software\Microsoft\Windows NT\CurrentVersion') |
| 81 | | _winreg.QueryValueEx(k, 'SystemRoot') |
| 82 | | return 1 |
| | 88 | winreg.QueryValueEx(k, 'SystemRoot') |
| | 89 | return True |
| 83 | 90 | except WindowsError: |
| 84 | | return 0 |
| | 91 | return False |
| 85 | 92 | # not windows NT |
| 86 | | return 0 |
| | 93 | return False |
| 87 | 94 | |
| 88 | 95 | |
| 89 | 96 | def isWindows(self): |
| … |
… |
|
| 117 | 124 | """Can threads be created? |
| 118 | 125 | """ |
| 119 | 126 | try: |
| 120 | | return imp.find_module('thread')[0] is None |
| | 127 | # Python 3.x changed this module's name. |
| | 128 | if compat._PY3: |
| | 129 | return imp.find_module('_thread')[0] is None |
| | 130 | else: |
| | 131 | return imp.find_module('thread')[0] is None |
| 121 | 132 | except ImportError: |
| 122 | 133 | return False |
| 123 | 134 | |
diff --git a/twisted/python/test/test_runtime.py b/twisted/python/test/test_runtime.py
index 4c94fb5..7c03ac4 100644
|
a
|
b
|
|
| 6 | 6 | """ |
| 7 | 7 | |
| 8 | 8 | import sys |
| | 9 | from unittest import TestCase |
| 9 | 10 | |
| 10 | 11 | from twisted.python.runtime import Platform, shortPythonVersion |
| 11 | | from twisted.trial.unittest import TestCase |
| | 12 | ## from twisted.trial.unittest import TestCase |
| | 13 | |
| | 14 | # TODO: Once trial is ported to Python 3.x these tests should start using it |
| | 15 | # again. Until then, use the standard Python unittesting framework. |
| | 16 | # To do this, uncomment the line above that imports TestCase from trial, and |
| | 17 | # delete the line that imports TestCase from unittest. |
| | 18 | # Ticket #5919 |
| 12 | 19 | |
| 13 | 20 | |
| 14 | 21 | |
| … |
… |
|
| 64 | 71 | self.assertTrue(sys.platform.startswith("linux")) |
| 65 | 72 | |
| 66 | 73 | |
| | 74 | def test_isWinNT(self): |
| | 75 | """ |
| | 76 | L{Platform.isWinNT}'s can return only C{True} or C{False}. |
| | 77 | """ |
| | 78 | platform = Platform() |
| | 79 | self.assertIn(platform.isWinNT(), (True, False)) |
| | 80 | |
| | 81 | |
| 67 | 82 | |
| 68 | 83 | class ForeignPlatformTests(TestCase): |
| 69 | 84 | """ |