ó
    Eñiî0  ã                  óH  • S r SSKJr  SSKJr  SSKrSSKrSSKJr  SSK	r	SSK
Jr  SSKrSSKrSSKJr  SSKJr  SS	KJr  S
SKJr  S
SKJr  S
SKJr  S
SKJr  S
SKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ r   SSK!J"r"  SSK!J#r#  SSK$J%r%  SSK&J'r'  SSK(J)r)  SSK*J+r+  \+\,\-\.4      " 5       r/\S   r0\\Rb                   " S S5      5       5       r2S+S jr3S,S  jr4S-S! jr5\"" S"S#9S.S$ j5       r6S/S% jr7\"      S0S& j5       r8S1S' jr9\" S(S(S)9    S2S* j5       r:g)3z>Support for providing temporary directories to test functions.é    )Úannotations)Ú	GeneratorN)ÚPath)Úrmtree)ÚAny)Úfinal)ÚLiteralé   )Úcleanup_dead_symlinks)ÚLOCK_TIMEOUT)Úmake_numbered_dir)Úmake_numbered_dir_with_cleanup)Úrm_rf)Úget_user_id)ÚConfig)ÚExitCode)Úhookimpl)ÚParser)Úcheck_ispytest)Úfixture)ÚFixtureRequest)ÚMonkeyPatch)ÚItem)Ú
TestReport)ÚStashKey©ÚallÚfailedÚnonec                  óÂ   • \ rS rSr% SrS\S'   S\S'   S\S'   S\S	'   S
\S'    SSS.           SS jjjr\SS.     SS jj5       rSS jr	SSS jjr
SS jrSrg)ÚTempPathFactoryé)   z‹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               óÌ   • [        U5        Uc  S U l        O6[        [        R                  R                  [        U5      5      5      U l        X@l        X l        X0l	        XPl
        g ©N)r   r$   r   ÚosÚpathÚabspathÚstrr%   r(   r*   r&   )ÚselfÚgiven_basetempÚretention_countÚretention_policyÚtraceÚbasetempr,   s          ÚK/home/mande/repo/quber/.venv/lib/python3.13/site-packages/_pytest/tmpdir.pyÚ__init__ÚTempPathFactory.__init__7   sQ   € ô 	�yÔ!ØÑ!Ø#'ˆDÕ ô
 $(¬¯©¯©¼¸NÓ8KÓ(LÓ#MˆDÔ ØŒØ /ÔØ!1ÔØ!�ó    c               ó0  • [        U5        [        UR                  S5      5      nUS:  a  [        SU S35      eUR                  S5      nUS;  a  [        SU S35      eU " UR                  R
                  UR                  R                  S5      UUS	S
9$ )zDCreate a factory according to pytest configuration.

:meta private:
Útmp_path_retention_countr   z6tmp_path_retention_count must be >= 0. Current input: Ú.Útmp_path_retention_policyr   zKtmp_path_retention_policy must be either all, failed, none. Current input: ÚtmpdirT)r4   r7   r5   r6   r,   )r   r'   ÚgetiniÚ
ValueErrorÚoptionr8   r7   Úget)ÚclsÚconfigr,   ÚcountÚpolicys        r9   Úfrom_configÚTempPathFactory.from_configN   s­   € ô 	�yÔ!Ü�F—M‘MÐ"<Ó=Ó>ˆØ�1‹9ÜØHÈÈÈqÐQóð ð —‘Ð:Ó;ˆØÐ2Ó2ÜØ]Ð^dÐ]eÐefÐgóð ñ Ø!Ÿ=™=×1Ñ1Ø—,‘,×"Ñ" 8Ó,Ø!Ø#Øñ
ð 	
r<   c                óÚ   • [         R                  R                  U5      nU R                  5       U-  R	                  5       R
                  U R                  5       :w  a  [        U S35      eU$ )Nz& is not a normalized and relative path)r/   r0   ÚnormpathÚgetbasetempÚresolveÚparentrC   )r3   Úbasenames     r9   Ú_ensure_relative_to_basetempÚ,TempPathFactory._ensure_relative_to_basetempn   s\   € Ü—7‘7×#Ñ# HÓ-ˆØ×ÑÓ Ñ)×2Ñ2Ó4×;Ñ;¸t×?OÑ?OÓ?QÓQÜ ˜zÐ)OÐPÓQÐQØˆr<   c                óì   • U R                  U5      nU(       d0  U R                  5       R                  U5      nUR                  SS9  U$ [	        U R                  5       USS9nU R                  SU5        U$ )aÆ  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 greater than any existing one: ``basename="foo-"`` and ``numbered=True``
    means that this function will create directories named ``"foo-0"``,
    ``"foo-1"``, ``"foo-2"`` and so on.

:returns:
    The path to the new directory.
éÀ  ©Úmode)ÚrootÚprefixrW   Úmktemp)rR   rN   ÚjoinpathÚmkdirr   r%   )r3   rQ   ÚnumberedÚps       r9   rZ   ÚTempPathFactory.mktempt   sr   € ð ×4Ñ4°XÓ>ˆÞØ× Ñ Ó"×+Ñ+¨HÓ5ˆAØ�G‰G˜ˆGÑð ˆô " t×'7Ñ'7Ó'9À(ÐQVÑWˆAØ�K‰K˜ !Ô$Øˆr<   c                óà  • U R                   b  U R                   $ U R                  bM  U R                  nUR                  5       (       a  [        U5        UR	                  SS9  UR                  5       nGO¦[        R                  R                  S5      n[        U=(       d    [        R                  " 5       5      R                  5       n[        5       =(       d    SnUR                  SU 35      n UR	                  SSS9  [        5       nUbÞ  [        R                   [        R"                  ;   a  S	OSnUR!                  US
9n[         R$                  " UR&                  5      (       a  [        SU S35      eUR(                  U:w  a  [        SU S35      eUR&                  S-  S:w  aC  [        R*                  [        R"                  ;   a  S	OSn	UR+                  UR&                  S-  U	S
9  U R,                  n
U R.                  S:X  a  Sn
[1        SUU
[2        SS9nUc   U5       eXl         U R5                  SU5        U$ ! [         a%    UR                  S5      nUR	                  SSS9   GNlf = f)ziReturn 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-)rY   rX   ÚkeepÚlock_timeoutrW   znew basetemp)r&   r$   Úexistsr   r\   rO   r/   ÚenvironrE   r   ÚtempfileÚ
gettempdirÚget_userr[   ÚOSErrorr   ÚstatÚsupports_follow_symlinksÚS_ISLNKÚst_modeÚst_uidÚchmodr(   r*   r   r   r%   )r3   r8   Úfrom_envÚtemprootÚuserÚrootdirÚuidÚstat_follow_symlinksÚrootdir_statÚchmod_follow_symlinksrf   s              r9   rN   ÚTempPathFactory.getbasetempŒ   sU  € ð �>‰>Ñ%Ø—>‘>Ð!à×ÑÑ+Ø×+Ñ+ˆ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Ñ5Ü!Ø2°7°)ð <2ð 2óð ð  ×&Ñ&¨#Ó-Ü!Ø2°7°)ð <2ð 2óð ð !×(Ñ(¨5Ñ0°QÓ6ä!#§¡¬R×-HÑ-HÓ!H™Èdð *ð —M‘MØ$×,Ñ,¨vÑ5Ø(=ð "ñ ð ×(Ñ(ˆDØ×%Ñ%¨Ó/Ø�Ü5Ø ØØÜ)ØñˆHð Ñ#Ð- XÓ-Ð#Ø!ŒØ�‰�N HÔ-Øˆøôm ó 9à"×+Ñ+Ð,?Ó@�Ø—‘ 5°4�Ô8ð9ús   Ã0H> È>+I-É,I-)r&   r$   r(   r*   r%   r.   )r4   r#   r5   r'   r6   r)   r8   r#   r,   ÚboolÚreturnÚNone)rG   r   r,   r}   r~   r!   )rQ   r2   r~   r2   )T)rQ   r2   r]   r}   r~   r   )r~   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r:   ÚclassmethodrJ   rR   rZ   rN   Ú__static_attributes__© r<   r9   r!   r!   )   s¹   ‡ ñð !Ó àƒKØÓØÓØ$Ó$ð !%ð"ð  ñ"à#ð"ð ð"ð (ð	"ð ð"ð ð"ð 
ö"ð. ð
  ñ	
àð
ð ð	
ð
 
ô
ó ð
ô>ö÷0Nr<   r!   c                 ób   •  SSK n U R                  5       $ ! [        [        [        4 a     gf = f)zhReturn the current user name, or None if getuser() does not work
in the current environment (see #1010).r   N)ÚgetpassÚgetuserÚImportErrorrm   ÚKeyError)rŠ   s    r9   rl   rl   Ý   s0   € ðãà�‰Ó Ð øÜœ¤(Ð+ó Ùðús   ‚ –.­.c                óš   • [        5       nU R                  UR                  5        [        R	                  U SS9nUR                  U SUSS9  g)z÷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!   rJ   Úsetattr)rG   Úmpr�   s      r9   Úpytest_configurer•   é   sI   € ô 
‹€BØ
×Ñ�r—w‘wÔÜ'×3Ñ3°FÀdÐ3ÐKÐØ‡J�JˆvÐ*Ð,=Àu€JÒMr<   c                óL   • U R                  SSSSS9  U R                  SSSSS	9  g )
Nr>   zfHow many sessions should we keep the `tmp_path` directories, according to `tmp_path_retention_policy`.Ú3Ústring)ÚhelpÚdefaultÚtyper@   zvControls which directories created by the `tmp_path` fixture are kept around, based on test outcome. (all/failed/none)r   )r™   r›   rš   )Úaddini)Úparsers    r9   Úpytest_addoptionrž   ö   s@   € Ø
‡M�MØ"ØuØàð ñ ð ‡M�MØ#ðàØð ò r<   Úsession)Úscopec                ó.   • U R                   R                  $ )zGReturn a :class:`pytest.TempPathFactory` instance for the test session.)rG   r�   )Úrequests    r9   Útmp_path_factoryr£     s   € ð �>‰>×+Ñ+Ð+r<   c                óŒ   • U R                   R                  n[        R                  " SSU5      nSnUS U nUR	                  USS9$ )Nz[\W]Ú_é   T)r]   )ÚnodeÚnameÚreÚsubrZ   )r¢   Úfactoryr¨   ÚMAXVALs       r9   Ú_mk_tmpr­     sF   € Ø�<‰<×Ñ€DÜ�6Š6�'˜3 Ó%€DØ€FØ��ˆ=€DØ�>‰>˜$¨ˆ>Ð.Ð.r<   c              #  ó   #   • [        X5      nUv •  UR                  nU R                  R                  [           nUS:X  a!  UR                  SS5      (       a
  [        USS9  U R                  R                  [        	 g7f)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_keyrE   r   )r¢   r£   r0   rI   Úresult_dicts        r9   Útmp_pathrµ     so   é € ô �7Ó-€DØ
‚Jð ×/Ñ/€FØ—,‘,×$Ñ$Ô%7Ñ8€Kà�Ó˜kŸo™o¨f°d×;Ñ;ô 	ˆt 4Ò(à�‰×ÑÔ-Ñ.ùs   ‚A<A>c                ó  • U R                   R                  nUR                  nUc  gUR                  nUS:X  a2  US:X  a,  UR                  c  UR                  5       (       a
  [        USS9  UR                  5       (       a  [        U5        gg)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°   )rG   r�   r&   r*   r$   Úis_dirr   r   )rŸ   Ú
exitstatusr£   r8   rI   s        r9   Úpytest_sessionfinishr¹   0  sƒ   € ð )0¯©×(HÑ(HÐØ×)Ñ)€HØÑØà×/Ñ/€Fà�a‹Ø�hÓØ×,Ñ,Ñ4à�?‰?×Ñô �8¨4Ò0ð ‡�×ÑÜ˜hÕ'ð r<   T)ÚwrapperÚtryfirstc              #  ó¦   #   • S v •nUR                   c   e0 nUR                  U R                  R                  [        U5      UR                   '   U$ 7fr.   )ÚwhenÚpassedr²   Ú
setdefaultr³   )Úitemr¯   ÚrepÚemptys       r9   Úpytest_runtest_makereportrÃ   I  sJ   é € ò €CØ�8‰8ÑÐÐØ€EØADÇÁ€D‡J�J×ÑÔ,¨eÓ4°S·X±XÑ>Ø€Jùs   ‚AA)r~   z
str | None)rG   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   Úcollections.abcr   Údataclassesr/   Úpathlibr   r©   Úshutilr   rn   rj   Útypingr   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   Údictr2   r}   r³   r)   Ú	dataclassr!   rl   r•   rž   r£   r­   rµ   r¹   rÃ   rˆ   r<   r9   Ú<module>rÕ      s7  ðá Då "å %Û Û 	Ý Û 	Ý Û Û Ý Ý Ý å *Ý !Ý &Ý 3Ý Ý &Ý !Ý #Ý #Ý ,Ý -Ý $Ý +Ý +Ý Ý &Ý "ð ˜d 3¨ 9™oÒ.Ó0Ð ØÐ/Ñ0€ð Ø×Ñ÷oð oó ó ðoôd	ô
Nôñ$ 	ˆyÑó,ó ð,ô/ð 	ð/Øð/Ø/>ð/àó/ó 	ð/ô0(ñ2 
�$ Ñ&ðØ
ðà,óó 'ñr<   