Ë
    •KêjÓ9  ã                  óp  — d Z ddlmZ ddlZddlmZ ddlmZ ddlZddl	Z	ddl
mZ ddlZddlmZ ddlZddlZddlmZ dd	lmZ dd
lmZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddlmZ ddlmZ ddlm Z  ddlm!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' ddl&m(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0  e0e1e2e3f      «       Z4ed   Z5eejl                   G d „ d!«      «       «       Z7d.d"„Z8d/d#„Z9d0d$„Z: e'd%¬&«      d1d'„«       Z;d2d(„Z<e'	 	 	 	 	 	 d3d)„«       Z=d4d*„Z> e!d+d+¬,«      	 	 	 	 d5d-„«       Z?y)6z>Support for providing temporary directories to test functions.é    )ÚannotationsN)Ú	Generator)Ú	ExitStack)ÚPath)Úrmtree)ÚAny)Úfinal)ÚLiteralé   )Ú_force_symlink)Úcleanup_dead_symlinks)Úfind_suffixes)ÚLOCK_TIMEOUT)Úmake_numbered_dir_with_cleanup)Ú	parse_num)Úrm_rf)Úget_user_id)ÚConfig)ÚExitCode)Úhookimpl)ÚParser)Úcheck_ispytest)Úfixture)ÚFixtureRequest)ÚMonkeyPatch)ÚItem)Ú
TestReport)ÚStashKey)ÚallÚfailedÚnonec                  ó°   — e Zd ZU dZded<   ded<   ded<   ded<   d	ed
<   	 dddœ	 	 	 	 	 	 	 	 	 	 	 dd„Zeddœ	 	 	 	 	 dd„«       Zdd„Zddd„Z	dd„Z
dd„Zy)ÚTempPathFactoryz“Factory for temporary directories under the common base temp directory,
    as discussed at :ref:`temporary directory location and retention`.
    úPath | NoneÚ_given_basetempr   Ú_traceÚ	_basetempÚintÚ_retention_countÚRetentionTypeÚ_retention_policyNF©Ú	_ispytestc               óþ   — t        |«       |€d | _        n6t        t        j                  j                  t        |«      «      «      | _        || _        || _        || _	        || _
        t        «       | _        i | _        y ©N)r   r%   r   ÚosÚpathÚabspathÚstrr&   r)   r+   r'   r   Ú_exit_stackÚ_next_number)ÚselfÚgiven_basetempÚretention_countÚretention_policyÚtraceÚbasetempr-   s          úS/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/_pytest/tmpdir.pyÚ__init__zTempPathFactory.__init__;   so   € ô 	�yÔ!ØÐ!Ø#'ˆDÕ ô
 $(¬¯©¯©¼¸NÓ8KÓ(LÓ#MˆDÔ ØˆŒØ /ˆÔØ!1ˆÔØ!ˆŒô %›;ˆÔð -/ˆÕó    c               ó
  — t        |«       t        |j                  d«      «      }|dk  rt        d|› d�«      ‚|j                  d«      } | |j                  j
                  |j                  j                  d«      ||d¬«      S )	zTCreate a factory according to pytest configuration.

        :meta private:
        Útmp_path_retention_countr   z6tmp_path_retention_count must be >= 0. Current input: ú.Útmp_path_retention_policyÚtmpdirT)r7   r:   r8   r9   r-   )r   r(   ÚgetiniÚ
ValueErrorÚoptionr;   r:   Úget)ÚclsÚconfigr-   ÚcountÚpolicys        r<   Úfrom_configzTempPathFactory.from_configX   s†   € ô 	�yÔ!Ü�F—M‘MÐ"<Ó=Ó>ˆØ�1Š9ÜØHÈÈÈqÐQóð ð !'§¡Ð.IÓ JˆáØ!Ÿ=™=×1Ñ1Ø—,‘,×"Ñ" 8Ó,Ø!Ø#Øô
ð 	
r>   c                óØ   — t         j                  j                  |«      }| j                  «       |z  j	                  «       j
                  | j                  «       k7  rt        |› d�«      ‚|S )Nz& is not a normalized and relative path)r0   r1   ÚnormpathÚgetbasetempÚresolveÚparentrE   )r6   Úbasenames     r<   Ú_ensure_relative_to_basetempz,TempPathFactory._ensure_relative_to_basetempt   s\   € Ü—7‘7×#Ñ# HÓ-ˆØ×ÑÓ Ñ)×2Ñ2Ó4×;Ñ;¸t×?OÑ?OÓ?QÒQÜ ˜zÐ)OÐPÓQÐQØˆr>   c                óØ   — | j                  |«      }|s3| j                  «       j                  |«      }|j                  d¬«       |S | j	                  |«      }| j                  d|«       |S )aJ  Create a new temporary directory managed by the factory.

        :param basename:
            Directory base name, must be a relative path.

        :param numbered:
            If ``True``, ensure the directory is unique by adding a numbered
            suffix: ``basename="foo-"`` and ``numbered=True``
            means that this function will create directories named ``"foo-0"``,
            ``"foo-1"``, ``"foo-2"`` and so on. Names that already exist in the
            base temporary directory are skipped.

        :returns:
            The path to the new directory.
        éÀ  ©ÚmodeÚmktemp)rS   rO   ÚjoinpathÚmkdirÚ_make_counted_dirr&   )r6   rR   ÚnumberedÚps       r<   rX   zTempPathFactory.mktempz   sj   € ð  ×4Ñ4°XÓ>ˆÙØ× Ñ Ó"×+Ñ+¨HÓ5ˆAØ�G‰G˜ˆGÔð ˆð ×&Ñ& xÓ0ˆAØ�K‰K˜ !Ô$Øˆr>   c           
     ó  — | j                  «       }|j                  «       }| j                  j                  |d«      }d}	 |j	                  |› |› �«      }	 |j                  d¬«       	 |dz   | j                  |<   t        ||dz   |«       |S # t        $ ri}|dz  }|dk(  r5t        t        t        t        ||«      «      d¬«      }t        ||«      dz   }n |dk(  rt        d	|› d
|› d|› d�«      |‚|dz  }Y d}~nd}~ww xY wŒÃ)a\  Create ``<prefix><n>`` in basetemp, using a per-prefix counter.

        Counting starts at 0 without listing basetemp, as basetemp is created
        by this factory. mkdir decides uniqueness:
        names it fails on are skipped, a run of 10 failures makes basetemp be
        listed once to jump past it, and 20 failures raise OSError.
        r   rU   rV   r   é
   éÿÿÿÿ)Údefaulté   z*could not create numbered dir with prefix z in z after z triesNÚcurrent)rO   Úlowerr5   rG   rY   rZ   ÚOSErrorÚmaxÚmapr   r   r   )	r6   ÚprefixÚrootÚkeyÚnumberÚ
collisionsr1   ÚeÚlisteds	            r<   r[   z!TempPathFactory._make_counted_dir“   s3  € ð ×ÑÓ!ˆØ�l‰l‹nˆØ×"Ñ"×&Ñ& s¨AÓ.ˆØˆ
ØØ—=‘= F 8¨F¨8Ð!4Ó5ˆDðØ—
‘
 �
Ô&ð$ Ø!'¨!¡ˆ×Ñ˜#ÑÜ�t˜V iÑ/°Ô6Øˆøô) ò  ð ˜a‘�
Ø Ò#Ü ÜœI¤}°T¸6Ó'BÓCÈRô�Fô ! ¨Ó0°1Ñ4‘FØ 2Ò%Ü!ØDÀVÀHÈDÐQUÐPVØ! * ¨Vð5óð ðð
 ˜a‘K�Fÿøð úð	 s   ÁB Â	C?ÂAC:Ã:C?c                óº  — | j                   �| j                   S | j                  �K| j                  }|j                  «       rt        |«       |j	                  d¬«       |j                  «       }�nt        j                  j                  d«      }t        |xs t        j                  «       «      j                  «       }t        «       xs d}|j                  d|› �«      }	 |j	                  dd¬«       t        «       }|�Øt        j                   t        j"                  v rd	nd}|j!                  |¬
«      }t!        j$                  |j&                  «      rt        d|› d�«      ‚|j(                  |k7  rt        d|› d�«      ‚|j&                  dz  dk7  rDt        j*                  t        j"                  v rd	nd}	|j+                  |j&                  dz  |	¬
«       | j,                  }
| j.                  dk(  rd}
t1        d||
t2        d| j4                  j6                  ¬«      }t9        j:                  | j4                  j<                  «       | j4                  j7                  t8        j>                  | j4                  j<                  «       |€J |«       ‚|| _         | jA                  d|«       |S # t        $ r( |j                  d«      }|j	                  dd¬«       Y �Œåw xY w)z�Return the base temporary directory, creating it if needed.

        :returns:
            The base temporary directory.
        rU   rV   ÚPYTEST_DEBUG_TEMPROOTÚunknownz
pytest-of-T)rW   Úexist_okzpytest-of-unknownF)Úfollow_symlinkszThe temporary directory z, is a symbolic link. Fix this and try again.z: is not owned by the current user. Fix this and try again.é?   r   iÀÿÿÿr!   zpytest-)rh   ri   ÚkeepÚlock_timeoutrW   Úregisterznew basetemp)!r'   r%   Úexistsr   rZ   rP   r0   ÚenvironrG   r   ÚtempfileÚ
gettempdirÚget_userrY   re   r   ÚstatÚsupports_follow_symlinksÚS_ISLNKÚst_modeÚst_uidÚchmodr)   r+   r   r   r4   ÚcallbackÚatexitrw   ÚcloseÚ
unregisterr&   )r6   r;   Úfrom_envÚtemprootÚuserÚrootdirÚuidÚstat_follow_symlinksÚrootdir_statÚchmod_follow_symlinksru   s              r<   rO   zTempPathFactory.getbasetemp¹   s   € ð �>‰>Ð%Ø—>‘>Ð!à×ÑÐ+Ø×+Ñ+ˆHØ�‰Ô Ü�h”Ø�N‰N ˆNÔ&Ø×'Ñ'Ó)ŠHä—z‘z—~‘~Ð&=Ó>ˆHÜ˜HÒ=¬×(;Ñ(;Ó(=Ó>×FÑFÓHˆHÜ“:Ò* ˆDð ×'Ñ'¨*°T°FÐ(;Ó<ˆGð9Ø—‘ 5°4�Ô8ô$ “-ˆCØˆäŸW™W¬×(CÑ(CÑC‘EÈð %ð  'Ÿ|™|Ð<P˜|ÓQ�Ü—<‘< × 4Ñ 4Ô5Ü!Ø2°7°)ð <2ð 2óð ð  ×&Ñ&¨#Ò-Ü!Ø2°7°)ð <2ð 2óð ð !×(Ñ(¨5Ñ0°QÒ6ä!#§¡¬R×-HÑ-HÑ!H™Èdð *ð —M‘MØ$×,Ñ,¨vÑ5Ø(=ð "ô ð ×(Ñ(ˆDØ×%Ñ%¨Ò/Ø�Ü5Ø ØØÜ)ØØ×)Ñ)×2Ñ2ôˆHô �O‰O˜D×,Ñ,×2Ñ2Ô3Ø×Ñ×%Ñ%¤f×&7Ñ&7¸×9IÑ9I×9OÑ9OÔPØÐ#Ð- XÓ-Ð#Ø!ˆŒØ�‰�N HÔ-Øˆøôy ò 9à"×+Ñ+Ð,?Ó@�Ø—‘ 5°4�×8ð9ús   Ã!J) Ê)-KËKr/   )r7   r$   r8   r(   r9   r*   r;   r$   r-   ÚboolÚreturnÚNone)rI   r   r-   r�   r�   r#   )rR   r3   r�   r3   )T)rR   r3   r\   r�   r�   r   )rh   r3   r�   r   )r�   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r=   ÚclassmethodrL   rS   rX   r[   rO   © r>   r<   r#   r#   -   s¿   … ñð !Ó àƒKØÓØÓØ$Ó$ð !%ð/ð  ñ/à#ð/ð ð/ð (ð	/ð ð/ð ð/ð 
ó/ð: ð
  ñ	
àð
ð ð	
ð
 
ò
ó ð
ó6ôó2$ôLTr>   r#   c                 ó`   — 	 ddl } | j                  «       S # t        t        t        f$ r Y yw xY w)zlReturn the current user name, or None if getuser() does not work
    in the current environment (see #1010).r   N)ÚgetpassÚgetuserÚImportErrorre   ÚKeyError)rš   s    r<   r|   r|     s0   € ðãà�‰Ó Ð øÜœ¤(Ð+ò Ùðús   ‚ –-¬-c                ó¦   — t        «       }| j                  |j                  «       t        j	                  | d¬«      }|j                  | d|d¬«       y)a  Create a TempPathFactory and attach it to the config object.

    This is to comply with existing plugins which expect the handler to be
    available at pytest_configure time, but ideally should be moved entirely
    to the tmp_path_factory session fixture.
    Tr,   Ú_tmp_path_factoryF)ÚraisingN)r   Úadd_cleanupÚundor#   rL   Úsetattr)rI   ÚmprŸ   s      r<   Úpytest_configurer¥     sI   € ô 
‹€BØ
×Ñ�r—w‘wÔÜ'×3Ñ3°FÀdÐ3ÓKÐØ‡J�JˆvÐ*Ð,=Àu€JÕMr>   c                óv   — | j                  dddt        t        z  ¬«       | j                  ddt        d¬«       y )	Nr@   zfHow many sessions should we keep the `tmp_path` directories, according to `tmp_path_retention_policy`.é   )Úhelpra   ÚtyperB   zdControls which directories created by the `tmp_path` fixture are kept around, based on test outcome.r   )r¨   r©   ra   )Úaddinir(   r3   r*   )Úparsers    r<   Úpytest_addoptionr¬   )  sB   € Ø
‡M�MØ"ØuØÜ”3‰Yð	 ô ð ‡M�MØ#ØsÜØð	 õ r>   Úsession)Úscopec                ó.   — | j                   j                  S )zGReturn a :class:`pytest.TempPathFactory` instance for the test session.)rI   rŸ   )Úrequests    r<   Útmp_path_factoryr±   9  s   € ð �>‰>×+Ñ+Ð+r>   c                ó�   — | j                   j                  }t        j                  dd|«      }d}|d | }|j	                  |d¬«      S )Nz[\W]Ú_é   T)r\   )ÚnodeÚnameÚreÚsubrX   )r°   Úfactoryr¶   ÚMAXVALs       r<   Ú_mk_tmpr»   @  sF   € Ø�<‰<×Ñ€DÜ�6‰6�'˜3 Ó%€DØ€FØ��ˆ=€DØ�>‰>˜$¨ˆ>Ó.Ð.r>   c              #  óü   K  — t        | |«      }|–— |j                  }| j                  j                  t           }|dk(  r|j                  dd«      rt        |d¬«       | j                  j                  t        = y­w)a;  Return a temporary directory (as :class:`pathlib.Path` object)
    which is unique to each test function invocation.
    The temporary directory is created as a subdirectory
    of the base temporary directory, with configurable retention,
    as discussed in :ref:`temporary directory location and retention`.
    r    ÚcallT©Úignore_errorsN)r»   r+   rµ   ÚstashÚtmppath_result_keyrG   r   )r°   r±   r1   rK   Úresult_dicts        r<   Útmp_pathrÃ   H  sp   è ø€ ô �7Ð,Ó-€DØ
‚Jð ×/Ñ/€FØ—,‘,×$Ñ$Ô%7Ñ8€Kà�Ò˜kŸo™o¨f°dÔ;ô 	ˆt 4Õ(à�‰×ÑÔ-Ñ.ùs   ‚A:A<c                ó6  — | j                   j                  }|j                  }|€y|j                  }|dk(  r.|dk(  r)|j                  €|j                  «       rt        |d¬«       |j                  «       rt        |«       |j                  j                  «        y)z�After each session, remove base directory if all the tests passed,
    the policy is "failed", and the basetemp is not specified by a user.
    Nr   r    Tr¾   )
rI   rŸ   r'   r+   r%   Úis_dirr   r   r4   r…   )r­   Ú
exitstatusr±   r;   rK   s        r<   Úpytest_sessionfinishrÇ   a  sŒ   € ð )0¯©×(HÑ(HÐØ×)Ñ)€HØÐØà×/Ñ/€Fà�aŠØ�hÒØ×,Ñ,Ð4à�?‰?Ôô �8¨4Õ0ð ‡�ÔÜ˜hÔ'ð × Ñ ×&Ñ&Õ(r>   T)ÚwrapperÚtryfirstc              #  ó¤   K  — d –—}|j                   €J ‚i }|j                  | j                  j                  t        |«      |j                   <   |S ­wr/   )ÚwhenÚpassedrÀ   Ú
setdefaultrÁ   )Úitemr½   ÚrepÚemptys       r<   Úpytest_runtest_makereportrÑ   }  sK   è ø€ ò €CØ�8‰8ÐÐÐØ€EØADÇÁ€D‡J�J×ÑÔ,¨eÓ4°S·X±XÑ>Ø€Jùs   ‚AA)r�   z
str | None)rI   r   r�   r‘   )r«   r   r�   r‘   )r°   r   r�   r#   )r°   r   r¹   r#   r�   r   )r°   r   r±   r#   r�   zGenerator[Path])rÆ   zint | ExitCode)rÎ   r   r�   z'Generator[None, TestReport, TestReport])@r•   Ú
__future__r   r„   Úcollections.abcr   Ú
contextlibr   Údataclassesr0   Úpathlibr   r·   Úshutilr   r}   rz   Útypingr   r	   r
   r   r   r   r   r   r   r   Ú_pytest.compatr   Ú_pytest.configr   r   r   Ú_pytest.config.argparsingr   Ú_pytest.deprecatedr   Ú_pytest.fixturesr   r   Ú_pytest.monkeypatchr   Ú_pytest.nodesr   Ú_pytest.reportsr   Ú_pytest.stashr   Údictr3   r�   rÁ   r*   Ú	dataclassr#   r|   r¥   r¬   r±   r»   rÃ   rÇ   rÑ   r˜   r>   r<   ú<module>rä      sE  ðá Då "ã Ý %Ý  Û Û 	Ý Û 	Ý Û Û Ý Ý Ý å #Ý *Ý "Ý !Ý 3Ý Ý Ý &Ý !Ý #Ý #Ý ,Ý -Ý $Ý +Ý +Ý Ý &Ý "ð /�X˜d 3¨ 9™oÑ.Ó0Ð ØÐ/Ñ0€ð Ø×Ñ÷^ð ^ó ó ð^óB	ó
Nóñ  	ˆyÔò,ó ð,ó/ð 	ð/Øð/Ø/>ð/àò/ó 	ð/ó0)ñ8 
�$ Ô&ðØ
ðà,òó 'ñr>   