+
    üÐ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`   € ô
 “:ˆØ×Ñ×ÒØ�O‰O˜H×,Ñ,Ó.Ô/Ø�O‰O˜H×.Ñ.Ó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:   € ô
 “:ˆØ×Ñ×ÒØ�O‰OœCŸL™L×3Ñ3°GÓ<Ö=ñ 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Õ/°×1OÑ1OÖ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   € ð	:Ü˜Ô$ð �O‰OœH›J×6Ñ6Ó8Ö9øô ô 	;Ø×ÑœX›Z×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   € ð 	×Ñœ $›×/Ñ/Ó1°7Ô;Ø×Ñœ $›×/Ñ/Ó1°7Ô;Ø×Ñœ 'Ó*×2Ñ2Ó4°gÔ>Ø×Ñœ &Ó)×1Ñ1Ó3°VÖ<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   € ð —k‘k“mˆÜ�+˜t×$Ô$¨à�G‰Gð	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_cgroupsSuggestsRealSystemÚ2DockerPlatformTests.test_cgroupsSuggestsRealSystemÎ   sg   € ð —k‘k“mˆÜ�+˜t×$Ô$¨à�G‰Gðô
÷ %ô ˜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   