+
    Dfj                         R t ^ RIt^ RIHt ^ RIHtHt ^ RIHt ^ RI	H
t  ! R R]4      t ! R R	]4      t ! R
 R]4      t ! R R]4      tR# )z&
Tests for L{twisted.python.runtime}.
N)namedModule)PlatformshortPythonVersion)SynchronousTestCase)suppressc                   6   a  ] tR t^t o RtV 3R lR ltRtV tR# )PythonVersionTestsz&
Tests the shortPythonVersion method.
c                   < V ^8  d   QhRR/#    returnN )format__classdict__s   "B/usr/lib/python3/dist-packages/twisted/python/test/test_runtime.py__annotate__PythonVersionTests.__annotate__   s     ? ? ?    c                    \        4       P                  R4      p\        ^4       F9  pV P                  \	        W,          4      \
        P                  V,          4       K;  	  R# )z5
Verify if the Python version is returned correctly.
.N)r   splitrangeassertEqualintsysversion_info)selfveris   &  r   test_shortPythonVersion*PythonVersionTests.test_shortPythonVersion   sF     !"((-qAS[#*:*:1*=> r   r   N)__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classdictcell__r   s   @r   r   r      s     ? ?r   r   c                      a  ] tR t^t o RtRtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 lt	V 3R lR lt
]! ]]R7      .]
n        V 3R lR ltV 3R lR ltRtV tR# )PlatformTestsz0
Tests for the default L{Platform} initializer.
zgtwisted.python.runtime.Platform.isWinNT was deprecated in Twisted 13.0. Use Platform.isWindows instead.c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   PlatformTests.__annotate__)   s     , ,d ,r   c                X    \        4       pV P                  VP                  4       4       R# )zh
L{Platform.isKnown} returns a boolean indicating whether this is one of
the L{runtime.knownPlatforms}.
N)r   
assertTrueisKnownr   platforms   & r   test_isKnownPlatformTests.test_isKnown)   s     
 :((*+r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r,   1   s     	2 	2 	2r   c                   \        4       pVP                  4       '       d`   V P                  VP                  4       4       V P                  VP	                  4       4       V P                  VP                  4       4       R# R# )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)r   isVistar.   isWinNT	isWindowsassertFalseisMacOSXr0   s   & r   test_isVistaConsistency%PlatformTests.test_isVistaConsistency1   s`    
 :OOH,,./OOH..01X..01 r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r,   <   s     : :$ :r   c                    \        4       pVP                  4       '       d#   V P                  VP                  4       R4       R# R# )zY
L{Platform.isMacOSX} can only return C{True} if L{Platform.getType}
returns C{'posix'}.
posixN)r   r:   r   getTyper0   s   & r   test_isMacOSXConsistency&PlatformTests.test_isMacOSXConsistency<   s8    
 :X--/9 r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r,   E   s     > > >r   c                    \        4       pVP                  4       '       d1   V P                  \        P                  P                  R4      4       R# R# )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)r   isLinuxr.   r   r1   
startswithr0   s   & r   test_isLinuxConsistency%PlatformTests.test_isLinuxConsistencyE   s:    
 :OOCLL33G<= r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r,   N   s     	& 	&d 	&r   c                    \        4       pVP                  4       pV P                  VR4       VP                  4       R8w  d   V P	                  V4       R# R# )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"}.
win32N)FT)r   r7   assertInr@   r9   )r   r1   r7   s   &  r   test_isWinNTPlatformTests.test_isWinNTN   sK    
 :""$g}-(W% )r   )categorymessagec                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r,   `   s     Q Q Qr   c                    \        4       pVP                  4        V P                  V P                  .4      pV P	                  \        V4      ^4       V P	                  V^ ,          R,          V P                  4       R# )zF
L{Platform.isWinNT} is deprecated in favor of L{platform.isWindows}.
rQ   N)r   r7   flushWarningstest_isWinNTDeprecatedr   lenisWinNTDeprecationMessage)r   r1   warningss   &  r   rU   $PlatformTests.test_isWinNTDeprecated`   sc     :%%t'B'B&CDX*!Y/1O1OPr   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r,   j   s     : :d :r   c                     \        R4       V P                  \        4       P                  4       4       R#   \         d,    T P                  \        4       P                  4       4        R# i ; i)zl
L{Platform.supportsThreads} returns C{True} if threads can be created in
this runtime, C{False} otherwise.
	threadingN)r   r.   r   supportsThreadsImportErrorr9   r   s   &r   test_supportsThreads"PlatformTests.test_supportsThreadsj   sR    	:$ OOHJ6689  	;XZ779:	;s   6 2A,+A,r   N)r!   r"   r#   r$   r%   rW   r2   r;   rA   rH   rN   SUPRESSDeprecationWarningr   rU   r`   r&   r'   r(   s   @r   r*   r*      sw     
	F 
, ,	2 	2: :> >	& 	& 	'-	
LQ Q: :r   r*   c                   Z   a  ] tR t^zt o RtV 3R lR ltV 3R lR ltV 3R lR ltRtV t	R	# )
ForeignPlatformTestsz<
Tests for L{Platform} based overridden initializer values.
c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   !ForeignPlatformTests.__annotate__   s     	= 	=d 	=r   c                N   V P                  \        R4      P                  4       R4       V P                  \        R4      P                  4       R4       V P                  \        R4      P                  4       R4       V P                  \        R4      P                  4       R4       R# )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.
ntrL   cer?   javaN)r   r   r@   r_   s   &r   test_getType!ForeignPlatformTests.test_getType   sz     	$//17;$//17;'*224g>&)113V<r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   rg      s     = =t =r   c                    V P                  \        RR4      P                  4       4       V P                  \        RR4      P                  4       4       V P                  \        RR4      P                  4       4       R# )z
If a system platform name is supplied to L{Platform}'s initializer, it
is used to determine the result of L{Platform.isMacOSX}, which returns
C{True} for C{"darwin"}, C{False} otherwise.
Ndarwinlinux2rL   )r.   r   r:   r9   r_   s   &r   test_isMacOSX"ForeignPlatformTests.test_isMacOSX   s\     	x099;<$1::<=$099;<r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   rg      s     
< 
<d 
<r   c                   V P                  \        RR4      P                  4       4       V P                  \        RR4      P                  4       4       V P                  \        RR4      P                  4       4       V P                  \        RR4      P                  4       4       V P                  \        RR4      P                  4       4       R# )z
If a system platform name is supplied to L{Platform}'s initializer, it
is used to determine the result of L{Platform.isLinux}, which returns
C{True} for values beginning with C{"linux"}, C{False} otherwise.
Nrp   rE   rq   linux3rL   )r9   r   rF   r.   r_   s   &r   test_isLinux!ForeignPlatformTests.test_isLinux   s     	$199;<w/779:x088:;x088:;$088:;r   r   N)
r!   r"   r#   r$   r%   rl   rr   rw   r&   r'   r(   s   @r   re   re   z   s(     	= 	== =
< 
<r   re   c                   l   a  ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltR
t	V t
R# )DockerPlatformTestsz8
Tests for L{twisted.python.runtime.Platform.isDocker}.
c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r    DockerPlatformTests.__annotate__   s     . .d .r   c                \    \        RR4      pV P                  VP                  4       4       R# )zF
If the platform is not Linux, C{isDocker()} always returns L{False}.
NrL   r   r9   isDockerr0   s   & r   test_noChecksOnLinux(DockerPlatformTests.test_noChecksOnLinux   s'     D'***,-r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r|      s     L L Lr   c                `    \        RR4      pV P                  VP                  RR7      4       R# )zk
If the platform is Linux, and the cgroups file in C{/proc} does not
exist, C{isDocker()} returns L{False}
NrE   fakepath_initCGroupLocationr~   r0   s   & r   test_noCGroups"DockerPlatformTests.test_noCGroups   s,    
 D'***z*JKr   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r|      s     L LD Lr   c                   V P                  4       p\        VR4      ;_uu_ 4       pVP                  R4       RRR4       \        RR4      pV P	                  VP                  VR7      4       R#   + '       g   i     L?; i)z
If the platform is Linux, and the cgroups file (faked out here) exists,
and one of the paths starts with C{/docker/}, C{isDocker()} returns
C{True}.
wbsd  10:debug:/
9:net_prio:/
8:perf_event:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
7:net_cls:/
6:freezer:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
5:devices:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
4:blkio:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
3:cpuacct:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
2:cpu:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
1:cpuset:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35fNrE   r   )mktempopenwriter   r.   r   r   cgroupsFilefr1   s   &   r   test_cgroupsSuggestsDocker.DockerPlatformTests.test_cgroupsSuggestsDocker   sf     kkm+t$$GG	U % D'*))k)JK! %$   A..A>	c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r|      s     M M Mr   c                   V P                  4       p\        VR4      ;_uu_ 4       pVP                  R4       RRR4       \        RR4      pV P	                  VP                  VR7      4       R#   + '       g   i     L?; i)z
If the platform is Linux, and the cgroups file (faked out here) exists,
and none of the paths starts with C{/docker/}, C{isDocker()} returns
C{False}.
r   sy   9:perf_event:/
8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/
2:cpuset:/
1:name=systemd:/systemNrE   r   )r   r   r   r   r9   r   r   s   &   r   test_cgroupsSuggestsRealSystem2DockerPlatformTests.test_cgroupsSuggestsRealSystem   sg     kkm+t$$GG
 % D'***{*KL %$r   r   N)r!   r"   r#   r$   r%   r   r   r   r   r&   r'   r(   s   @r   rz   rz      s8     . .L LL L2M Mr   rz   )r%   r   twisted.python.reflectr   twisted.python.runtimer   r   twisted.trial.unittestr   twisted.trial.utilr   rb   r   r*   re   rz   r   r   r   <module>r      sW   
  . ? 6 2?, ?X:' X:v$<. $<NCM- CMr   