ó
    ùÞ j×3  ã                  ó\  • S r SSKJr  SSK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.  \.\/\0\14      " 5       r2\S   r3\\Rh                   " S S5      5       5       r5S,S  jr6S-S! jr7S.S" jr8\%" S#S$9S/S% j5       r9S0S& jr:\%      S1S' j5       r;S2S( jr<\" S)S)S*9    S3S+ j5       r=g)4z>Support for providing temporary directories to test functions.é    )ÚannotationsN)Ú	Generator)Ú	ExitStack)Ú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
        [        5       U l        g ©N)r   r%   r   ÚosÚpathÚabspathÚstrr&   r)   r+   r'   r   Ú_exit_stack)ÚselfÚgiven_basetempÚretention_countÚretention_policyÚtraceÚbasetempr-   s          ÚH/var/www/html/gaurav/venv/lib/python3.13/site-packages/_pytest/tmpdir.pyÚ__init__ÚTempPathFactory.__init__9   s]   € ô 	�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)r6   r9   r7   r8   r-   )r   r(   ÚgetiniÚ
ValueErrorÚoptionr:   r9   Úget)ÚclsÚconfigr-   ÚcountÚpolicys        r;   Úfrom_configÚTempPathFactory.from_configS   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)r0   r1   ÚnormpathÚgetbasetempÚresolveÚparentrE   )r5   Úbasenames     r;   Ú_ensure_relative_to_basetempÚ,TempPathFactory._ensure_relative_to_basetemps   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ÚprefixrY   Úmktemp)rT   rP   ÚjoinpathÚmkdirr   r&   )r5   rS   ÚnumberedÚps       r;   r\   ÚTempPathFactory.mktempy   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U R4                  R6                  S9n[8        R:                  " U R4                  R<                  5        U R4                  R7                  [8        R>                  U R4                  R<                  5        Uc   U5       eXl         U RA                  SU5        U$ ! [         a%    UR                  S5      nUR	                  SSS9   GNéf = f)ziReturn the base temporary directory, creating it if needed.

:returns:
    The base temporary directory.
rW   rX   ÚPYTEST_DEBUG_TEMPROOTÚunknownz
pytest-of-T)rY   Ú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-)r[   rZ   ÚkeepÚlock_timeoutrY   Úregisterznew basetemp)!r'   r%   Úexistsr   r^   rQ   r0   ÚenvironrG   r   ÚtempfileÚ
gettempdirÚget_userr]   ÚOSErrorr   ÚstatÚsupports_follow_symlinksÚS_ISLNKÚst_modeÚst_uidÚchmodr)   r+   r   r   r4   ÚcallbackÚatexitrj   ÚcloseÚ
unregisterr&   )r5   r:   Úfrom_envÚtemprootÚuserÚrootdirÚuidÚstat_follow_symlinksÚrootdir_statÚchmod_follow_symlinksrh   s              r;   rP   Ú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Ñ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   Ã0J; Ê;+K*Ë)K*)r'   r4   r%   r)   r+   r&   r/   )r6   r$   r7   r(   r8   r*   r:   r$   r-   ÚboolÚreturnÚNone)rI   r   r-   r„   r…   r"   )rS   r3   r…   r3   )T)rS   r3   r_   r„   r…   r   )r…   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r<   ÚclassmethodrL   rT   r\   rP   Ú__static_attributes__© r>   r;   r"   r"   +   s¹   ‡ ñð !Ó àƒKØÓØÓØ$Ó$ð !%ð'ð  ñ'à#ð'ð ð'ð (ð	'ð ð'ð ð'ð 
ö'ð4 ð
  ñ	
àð
ð ð	
ð
 
ô
ó ð
ô>ö÷0T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ÚImportErrorrp   ÚKeyError)r‘   s    r;   ro   ro   è   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"   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                ó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ÚtyperB   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    r;   Úpytest_addoptionr¥     s@   € Ø
‡M�MØ"ØuØàð ñ ð ‡M�MØ#ðàØð ò r>   Úsession)Úscopec                ó.   • U R                   R                  $ )zGReturn a :class:`pytest.TempPathFactory` instance for the test session.)rI   r–   )Úrequests    r;   Ú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Úsubr\   )r©   Úfactoryr¯   ÚMAXVALs       r;   Ú_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_keyrG   r   )r©   rª   r1   rK   Úresult_dicts        r;   Útmp_pathr¼   "  so   é € ô �7Ó-€DØ
‚Jð ×/Ñ/€FØ—,‘,×$Ñ$Ô%7Ñ8€Kà�Ó˜kŸo™o¨f°d×;Ñ;ô 	ˆt 4Ò(à�‰×ÑÔ-Ñ.ùs   ‚A<A>c                óL  • 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        UR                  R                  5         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·   )
rI   r–   r'   r+   r%   Úis_dirr   r   r4   ry   )r¦   Ú
exitstatusrª   r:   rK   s        r;   Úpytest_sessionfinishrÀ   ;  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       r;   Úpytest_runtest_makereportrÊ   W  sJ   é € ò €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   rx   Úcollections.abcr   Ú
contextlibr   Údataclassesr0   Úpathlibr   r°   Úshutilr   rq   rm   Ú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   Údictr3   r„   rº   r*   Ú	dataclassr"   ro   rœ   r¥   rª   r´   r¼   rÀ   rÊ   r�   r>   r;   Ú<module>rÝ      s=  ðá Då "ã Ý %Ý  Û Û 	Ý Û 	Ý Û Û Ý Ý Ý å *Ý !Ý &Ý 3Ý Ý &Ý !Ý #Ý #Ý ,Ý -Ý $Ý +Ý +Ý Ý &Ý "ð ˜d 3¨ 9™oÒ.Ó0Ð ØÐ/Ñ0€ð Ø×Ñ÷xð xó ó ðxôv	ô
Nôñ$ 	ˆyÑó,ó ð,ô/ð 	ð/Øð/Ø/>ð/àó/ó 	ð/ô0)ñ8 
�$ Ñ&ðØ
ðà,óó 'ñr>   