§
    Ètºf°  ã                   ó¶   — d Z ddlZddlmZ ddlmZmZ ddlmZ ddl	m
Z  G d„ de¦  «        Z G d	„ d
e¦  «        Z G d„ de¦  «        Z G d„ de¦  «        ZdS )z&
Tests for L{twisted.python.runtime}.
é    N)ÚnamedModule)ÚPlatformÚshortPythonVersion)ÚSynchronousTestCase)Úsuppressc                   ó   — e Zd ZdZdd„ZdS )ÚPythonVersionTestsz.
    Tests the shortPythonVersion method.
    ÚreturnNc                 óÞ   — t          ¦   «                              d¦  «        }t          d¦  «        D ];}|                      t	          ||         ¦  «        t
          j        |         ¦  «         Œ<dS )zE
        Verify if the Python version is returned correctly.
        ú.é   N)r   ÚsplitÚrangeÚassertEqualÚintÚsysÚversion_info)ÚselfÚverÚis      ú_/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/python/test/test_runtime.pyÚtest_shortPythonVersionz*PythonVersionTests.test_shortPythonVersion   sg   € õ !Ñ"Ô"×(Ò(¨Ñ-Ô-ˆÝ�q‘”ð 	?ð 	?ˆAØ×Ò�S  Q¤™[œ[­#Ô*:¸1Ô*=Ñ>Ô>Ð>Ð>ð	?ð 	?ó    ©r
   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   © r   r   r	   r	      s2   € € € € € ðð ð?ð ?ð ?ð ?ð ?ð ?r   r	   c                   ót   — e Zd ZdZdZdd„Zdd„Zdd„Zdd„Zdd	„Z	 e
ee¬
¦  «        ge	_        dd„Zdd„ZdS )ÚPlatformTestsz8
    Tests for the default L{Platform} initializer.
    zgtwisted.python.runtime.Platform.isWinNT was deprecated in Twisted 13.0. Use Platform.isWindows instead.r
   Nc                 óp   — t          ¦   «         }|                      |                     ¦   «         ¦  «         dS )z€
        L{Platform.isKnown} returns a boolean indicating whether this is one of
        the L{runtime.knownPlatforms}.
        N)r   Ú
assertTrueÚisKnown©r   Úplatforms     r   Útest_isKnownzPlatformTests.test_isKnown)   s1   € õ
 ‘:”:ˆØ�Š˜×(Ò(Ñ*Ô*Ñ+Ô+Ð+Ð+Ð+r   c                 ó8  — t          ¦   «         }|                     ¦   «         rw|                      |                     ¦   «         ¦  «         |                      |                     ¦   «         ¦  «         |                      |                     ¦   «         ¦  «         dS dS )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ÚisMacOSXr%   s     r   Útest_isVistaConsistencyz%PlatformTests.test_isVistaConsistency1   s�   € õ
 ‘:”:ˆØ×ÒÑÔð 	2Ø�OŠO˜H×,Ò,Ñ.Ô.Ñ/Ô/Ð/Ø�OŠO˜H×.Ò.Ñ0Ô0Ñ1Ô1Ð1Ø×Ò˜X×.Ò.Ñ0Ô0Ñ1Ô1Ð1Ð1Ð1ð	2ð 	2r   c                 óž   — t          ¦   «         }|                     ¦   «         r*|                      |                     ¦   «         d¦  «         dS dS )zq
        L{Platform.isMacOSX} can only return C{True} if L{Platform.getType}
        returns C{'posix'}.
        ÚposixN)r   r-   r   ÚgetTyper%   s     r   Útest_isMacOSXConsistencyz&PlatformTests.test_isMacOSXConsistency<   sS   € õ
 ‘:”:ˆØ×ÒÑÔð 	:Ø×Ò˜X×-Ò-Ñ/Ô/°Ñ9Ô9Ð9Ð9Ð9ð	:ð 	:r   c                 ó²   — t          ¦   «         }|                     ¦   «         r4|                      t          j                             d¦  «        ¦  «         dS dS )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   r&   Ú
startswithr%   s     r   Útest_isLinuxConsistencyz%PlatformTests.test_isLinuxConsistencyE   sS   € õ
 ‘:”:ˆØ×ÒÑÔð 	>Ø�OŠO�CœL×3Ò3°GÑ<Ô<Ñ=Ô=Ð=Ð=Ð=ð	>ð 	>r   c                 óÔ   — t          ¦   «         }|                     ¦   «         }|                      |d¦  «         |                     ¦   «         dk    r|                      |¦  «         dS dS )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"}.
        )FTÚwin32N)r   r*   ÚassertInr1   r,   )r   r&   r*   s      r   Útest_isWinNTzPlatformTests.test_isWinNTN   sk   € õ
 ‘:”:ˆØ×"Ò"Ñ$Ô$ˆØ�Š�g˜}Ñ-Ô-Ð-Ø×ÒÑÔ Ò(Ð(Ø×Ò˜WÑ%Ô%Ð%Ð%Ð%ð )Ð(r   )ÚcategoryÚmessagec                 ó  — t          ¦   «         }|                     ¦   «          |                      | j        g¦  «        }|                      t          |¦  «        d¦  «         |                      |d         d         | j        ¦  «         dS )zV
        L{Platform.isWinNT} is deprecated in favor of L{platform.isWindows}.
        é   r   r=   N)r   r*   ÚflushWarningsÚtest_isWinNTDeprecatedr   ÚlenÚisWinNTDeprecationMessage)r   r&   Úwarningss      r   rA   z$PlatformTests.test_isWinNTDeprecated`   s|   € õ ‘:”:ˆØ×ÒÑÔÐØ×%Ò% tÔ'BÐ&CÑDÔDˆØ×Ò�˜X™œ¨Ñ*Ô*Ð*Ø×Ò˜ !œ YÔ/°Ô1OÑPÔPÐPÐPÐPr   c                 ó  — 	 t          d¦  «         |                      t          ¦   «                              ¦   «         ¦  «         dS # t          $ r7 |                      t          ¦   «                              ¦   «         ¦  «         Y dS w xY w)z„
        L{Platform.supportsThreads} returns C{True} if threads can be created in
        this runtime, C{False} otherwise.
        Ú	threadingN)r   r#   r   ÚsupportsThreadsÚImportErrorr,   ©r   s    r   Útest_supportsThreadsz"PlatformTests.test_supportsThreadsj   s‰   € ð	:Ý˜Ñ$Ô$Ð$ð �OŠO�H™JœJ×6Ò6Ñ8Ô8Ñ9Ô9Ð9Ð9Ð9øõ ð 	;ð 	;ð 	;Ø×Ò�X™ZœZ×7Ò7Ñ9Ô9Ñ:Ô:Ð:Ð:Ð:Ð:ð	;øøøs   ‚A Á=BÂBr   )r   r   r   r   rC   r'   r.   r2   r7   r;   ÚSUPRESSÚDeprecationWarningr   rA   rJ   r   r   r   r!   r!      sß   € € € € € ðð ð
	Fð ð
,ð ,ð ,ð ,ð	2ð 	2ð 	2ð 	2ð:ð :ð :ð :ð>ð >ð >ð >ð	&ð 	&ð 	&ð 	&ð 	ˆØ'Ø-ð	
ñ 	
ô 	
ð€LÔðQð Qð Qð Qð:ð :ð :ð :ð :ð :r   r!   c                   ó*   — e Zd ZdZdd„Zdd„Zdd„ZdS )ÚForeignPlatformTestszD
    Tests for L{Platform} based overridden initializer values.
    r
   Nc                 ó®  — |                       t          d¦  «                             ¦   «         d¦  «         |                       t          d¦  «                             ¦   «         d¦  «         |                       t          d¦  «                             ¦   «         d¦  «         |                       t          d¦  «                             ¦   «         d¦  «         dS )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.
        Úntr9   Úcer0   ÚjavaN)r   r   r1   rI   s    r   Útest_getTypez!ForeignPlatformTests.test_getType   s®   € ð 	×Ò� $™œ×/Ò/Ñ1Ô1°7Ñ;Ô;Ð;Ø×Ò� $™œ×/Ò/Ñ1Ô1°7Ñ;Ô;Ð;Ø×Ò� 'Ñ*Ô*×2Ò2Ñ4Ô4°gÑ>Ô>Ð>Ø×Ò� &Ñ)Ô)×1Ò1Ñ3Ô3°VÑ<Ô<Ð<Ð<Ð<r   c                 óD  — |                       t          dd¦  «                             ¦   «         ¦  «         |                      t          dd¦  «                             ¦   «         ¦  «         |                      t          dd¦  «                             ¦   «         ¦  «         dS )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Úlinux2r9   )r#   r   r-   r,   rI   s    r   Útest_isMacOSXz"ForeignPlatformTests.test_isMacOSXŠ   s†   € ð 	�Š�  xÑ0Ô0×9Ò9Ñ;Ô;Ñ<Ô<Ð<Ø×Ò� $¨Ñ1Ô1×:Ò:Ñ<Ô<Ñ=Ô=Ð=Ø×Ò� $¨Ñ0Ô0×9Ò9Ñ;Ô;Ñ<Ô<Ð<Ð<Ð<r   c                 ó  — |                       t          dd¦  «                             ¦   «         ¦  «         |                      t          dd¦  «                             ¦   «         ¦  «         |                      t          dd¦  «                             ¦   «         ¦  «         |                      t          dd¦  «                             ¦   «         ¦  «         |                       t          dd¦  «                             ¦   «         ¦  «         dS )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.
        NrU   r4   rV   Úlinux3r9   )r,   r   r5   r#   rI   s    r   Útest_isLinuxz!ForeignPlatformTests.test_isLinux”   sÖ   € ð 	×Ò� $¨Ñ1Ô1×9Ò9Ñ;Ô;Ñ<Ô<Ð<Ø�Š�  wÑ/Ô/×7Ò7Ñ9Ô9Ñ:Ô:Ð:Ø�Š�  xÑ0Ô0×8Ò8Ñ:Ô:Ñ;Ô;Ð;Ø�Š�  xÑ0Ô0×8Ò8Ñ:Ô:Ñ;Ô;Ð;Ø×Ò� $¨Ñ0Ô0×8Ò8Ñ:Ô:Ñ;Ô;Ð;Ð;Ð;r   r   )r   r   r   r   rS   rW   rZ   r   r   r   rN   rN   z   sZ   € € € € € ðð ð	=ð 	=ð 	=ð 	=ð=ð =ð =ð =ð
<ð 
<ð 
<ð 
<ð 
<ð 
<r   rN   c                   ó2   — e Zd ZdZdd„Zdd„Zdd„Zdd„ZdS )	ÚDockerPlatformTestsz@
    Tests for L{twisted.python.runtime.Platform.isDocker}.
    r
   Nc                 ót   — t          dd¦  «        }|                      |                     ¦   «         ¦  «         dS )zV
        If the platform is not Linux, C{isDocker()} always returns L{False}.
        Nr9   ©r   r,   ÚisDockerr%   s     r   Útest_noChecksOnLinuxz(DockerPlatformTests.test_noChecksOnLinux¦   s9   € õ ˜D 'Ñ*Ô*ˆØ×Ò˜×*Ò*Ñ,Ô,Ñ-Ô-Ð-Ð-Ð-r   c                 óx   — t          dd¦  «        }|                      |                     d¬¦  «        ¦  «         dS )zƒ
        If the platform is Linux, and the cgroups file in C{/proc} does not
        exist, C{isDocker()} returns L{False}
        Nr4   Úfakepath©Ú_initCGroupLocationr^   r%   s     r   Útest_noCGroupsz"DockerPlatformTests.test_noCGroups­   s>   € õ
 ˜D 'Ñ*Ô*ˆØ×Ò˜×*Ò*¸zÐ*ÑJÔJÑKÔKÐKÐKÐKr   c                 ó  — |                       ¦   «         }t          |d¦  «        5 }|                     d¦  «         ddd¦  «         n# 1 swxY w Y   t          dd¦  «        }|                      |                     |¬¦  «        ¦  «         dS )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/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35fNr4   rc   )ÚmktempÚopenÚwriter   r#   r_   ©r   ÚcgroupsFileÚfr&   s       r   Útest_cgroupsSuggestsDockerz.DockerPlatformTests.test_cgroupsSuggestsDockerµ   sÉ   € ð —k’k‘m”mˆÝ�+˜tÑ$Ô$ð 	¨à�GŠGð	Uñô ð ð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	õ ˜D 'Ñ*Ô*ˆØ�Š˜×)Ò)¸kÐ)ÑJÔJÑKÔKÐKÐKÐKó   ¥AÁAÁAc                 ó  — |                       ¦   «         }t          |d¦  «        5 }|                     d¦  «         ddd¦  «         n# 1 swxY w Y   t          dd¦  «        }|                      |                     |¬¦  «        ¦  «         dS )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}.
        rg   sy   9:perf_event:/
8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/
2:cpuset:/
1:name=systemd:/systemNr4   rc   )rh   ri   rj   r   r,   r_   rk   s       r   Útest_cgroupsSuggestsRealSystemz2DockerPlatformTests.test_cgroupsSuggestsRealSystemÎ   sÊ   € ð —k’k‘m”mˆÝ�+˜tÑ$Ô$ð 	¨à�GŠGðñ
ô 
ð 
ð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	õ ˜D 'Ñ*Ô*ˆØ×Ò˜×*Ò*¸{Ð*ÑKÔKÑLÔLÐLÐLÐLro   r   )r   r   r   r   r`   re   rn   rq   r   r   r   r\   r\   ¡   s|   € € € € € ðð ð.ð .ð .ð .ðLð Lð Lð LðLð Lð Lð Lð2Mð Mð Mð Mð Mð Mr   r\   )r   r   Útwisted.python.reflectr   Útwisted.python.runtimer   r   Útwisted.trial.unittestr   Útwisted.trial.utilr   rK   r	   r!   rN   r\   r   r   r   ú<module>rv      s<  ððð ð
 €
€
€
à .Ð .Ð .Ð .Ð .Ð .Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2ð?ð ?ð ?ð ?ð ?Ð,ñ ?ô ?ð ?ðX:ð X:ð X:ð X:ð X:Ð'ñ X:ô X:ð X:ðv$<ð $<ð $<ð $<ð $<Ð.ñ $<ô $<ð $<ðNCMð CMð CMð CMð CMÐ-ñ CMô CMð CMð CMð CMr   