ϪfdZddlZddlmZddlmZmZddlmZddl m Z GddeZ Gd d eZ Gd d eZGd deZy)z& Tests for L{twisted.python.runtime}. N) namedModule)PlatformshortPythonVersion)SynchronousTestCase)suppressceZdZdZddZy)PythonVersionTestsz. Tests the shortPythonVersion method. Nctjd}tdD]1}|jt ||t j |3y)zE Verify if the Python version is returned correctly. .N)rsplitrange assertEqualintsys version_info)selfveris B/usr/lib/python3/dist-packages/twisted/python/test/test_runtime.pytest_shortPythonVersionz*PythonVersionTests.test_shortPythonVersionsM!"((-q ?A   SQ[#*:*:1*= > ?returnN)__name__ __module__ __qualname____doc__rrrr r s ?rr cleZdZdZdZd dZd dZd dZd dZd dZ e e e ge _ d d Z d d Zy) PlatformTestsz8 Tests for the default L{Platform} initializer. zgtwisted.python.runtime.Platform.isWinNT was deprecated in Twisted 13.0. Use Platform.isWindows instead.NcVt}|j|jy)z L{Platform.isKnown} returns a boolean indicating whether this is one of the L{runtime.knownPlatforms}. N)r assertTrueisKnownrplatforms r test_isKnownzPlatformTests.test_isKnown)s : ((*+rct}|jr^|j|j|j|j |j |j yy)z Verify consistency of L{Platform.isVista}: it can only be C{True} if L{Platform.isWinNT} and L{Platform.isWindows} are C{True}. N)risVistar#isWinNT isWindows assertFalseisMacOSXr%s rtest_isVistaConsistencyz%PlatformTests.test_isVistaConsistency1s] :     OOH,,. / OOH..0 1   X..0 1 rczt}|jr!|j|jdyy)zq L{Platform.isMacOSX} can only return C{True} if L{Platform.getType} returns C{'posix'}. posixN)rr-rgetTyper%s rtest_isMacOSXConsistencyz&PlatformTests.test_isMacOSXConsistency<s5 :       X--/ 9 rct}|jr/|jtjj dyy)z L{Platform.isLinux} can only return C{True} if L{Platform.getType} returns C{'posix'} and L{sys.platform} starts with C{"linux"}. linuxN)risLinuxr#rr& startswithr%s rtest_isLinuxConsistencyz%PlatformTests.test_isLinuxConsistencyEs7 :     OOCLL33G< = rct}|j}|j|d|jdk7r|j |yy)z L{Platform.isWinNT} can return only C{False} or C{True} and can not return C{True} if L{Platform.getType} is not C{"win32"}. )FTwin32N)rr*assertInr1r,)rr&r*s r test_isWinNTzPlatformTests.test_isWinNTNsK :""$ g}-     (   W % )r)categorymessagect}|j|j|jg}|j t |d|j |dd|j y)zV L{Platform.isWinNT} is deprecated in favor of L{platform.isWindows}. rr=N)rr* flushWarningstest_isWinNTDeprecatedrlenisWinNTDeprecationMessage)rr&warningss rrAz$PlatformTests.test_isWinNTDeprecated`sc:%%t'B'B&CD X* !Y/1O1OPrc td|jtjy#t$r*|j tjYywxYw)z L{Platform.supportsThreads} returns C{True} if threads can be created in this runtime, C{False} otherwise. threadingN)rr#rsupportsThreads ImportErrorr,rs rtest_supportsThreadsz"PlatformTests.test_supportsThreadsjsR :  $ OOHJ668 9 ;   XZ779 : ;s 50A('A(r)rrrrrCr'r.r2r7r;SUPRESSDeprecationWarningrrArJrrrr!r!sP  F , 2:> & '- LQ :rr!c(eZdZdZddZddZddZy)ForeignPlatformTestszD Tests for L{Platform} based overridden initializer values. NcL|jtdjd|jtdjd|jtdjd|jtdjdy)z If an operating system name is supplied to L{Platform}'s initializer, L{Platform.getType} returns the platform type which corresponds to that name. ntr9cer0javaN)rrr1rIs r test_getTypez!ForeignPlatformTests.test_getTypesz $//17; $//17; '*224g> &)113VrvsW  .?62 ?, ?X:'X:v$<.$