Ë
    V.jo,  ã                  óH  — d 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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)m*Z*  e*ee+e,f      «       Z-ed   Z.eej^                   G d„ d«      «       «       Z0d,d „Z1d-d!„Z2d.d"„Z3 e!d#¬$«      d/d%„«       Z4d0d&„Z5e!	 	 	 	 	 	 d1d'„«       Z6d2d(„Z7 ed)d)¬*«      	 	 	 	 d3d+„«       Z8y)4z>Support for providing temporary directories to test functions.é    )ÚannotationsN)ÚPath)Úrmtree)ÚAny)ÚDict)Úfinal)Ú	Generator)Ú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                  ó¨   — 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
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        |«      «      «      | _        || _        || _        || _	        || _
        y ©N)r   r$   r   ÚosÚpathÚabspathÚstrr%   r(   r*   r&   )ÚselfÚgiven_basetempÚretention_countÚretention_policyÚtraceÚbasetempr,   s          úPC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\_pytest/tmpdir.pyÚ__init__zTempPathFactory.__init__7   sY   € ô 	�yÔ!ØÐ!Ø#'ˆDÕ ô
 $(¬¯©¯©¼¸NÓ8KÓ(LÓ#MˆDÔ ØˆŒØ /ˆÔØ!1ˆÔØ!ˆ�ó    c               ó0  — t        |«       t        |j                  d«      «      }|dk  rt        d|› d�«      ‚|j                  d«      }|dvrt        d|› 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_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_configzTempPathFactory.from_configN   s­   € ô 	�yÔ!Ü�F—M‘MÐ"<Ó=Ó>ˆØ�1Š9ÜØHÈÈÈqÐQóð ð —‘Ð:Ó;ˆØÐ2Ñ2ÜØ]Ð^dÐ]eÐefÐgóð ñ Ø!Ÿ=™=×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)r/   r0   ÚnormpathÚgetbasetempÚresolveÚparentrB   )r3   Úbasenames     r9   Ú_ensure_relative_to_basetempz,TempPathFactory._ensure_relative_to_basetempn   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 t	        | j                  «       |d¬«      }| j                  d|«       |S )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ÚprefixrT   Úmktemp)rP   rL   ÚjoinpathÚmkdirr   r%   )r3   rO   ÚnumberedÚps       r9   rW   zTempPathFactory.mktempt   sr   € ð ×4Ñ4°XÓ>ˆÙØ× Ñ Ó"×+Ñ+¨HÓ5ˆAØ�G‰G˜ˆGÔð ˆô " t×'7Ñ'7Ó'9À(ÐQVÔWˆAØ�K‰K˜ !Ô$Øˆr;   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        «       }|�c|j!                  «       }|j"                  |k7  rt        d	|› d
�«      ‚|j$                  dz  dk7  r#t        j&                  ||j$                  dz  «       | j(                  }| j*                  dk(  rd}t-        d||t.        d¬«      }|€J |«       ‚|| _         | j1                  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.
        rR   rS   ÚPYTEST_DEBUG_TEMPROOTÚunknownz
pytest-of-T)rT   Úexist_okzpytest-of-unknownzThe temporary directory z: is not owned by the current user. Fix this and try again.é?   r   iÀÿÿÿr    zpytest-)rV   rU   ÚkeepÚlock_timeoutrT   znew basetemp)r&   r$   Úexistsr   rY   rM   r/   ÚenvironrD   r   ÚtempfileÚ
gettempdirÚget_userrX   ÚOSErrorr   ÚstatÚst_uidÚst_modeÚchmodr(   r*   r   r   r%   )	r3   r8   Úfrom_envÚtemprootÚuserÚrootdirÚuidÚrootdir_statra   s	            r9   rL   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ØˆØ&Ÿ|™|›~�Ø×&Ñ&¨#Ò-Ü!Ø2°7°)ð <2ð 2óð ð !×(Ñ(¨5Ñ0°QÒ6Ü—H‘H˜W l×&:Ñ&:¸VÑ&CÔDØ×(Ñ(ˆDØ×%Ñ%¨Ò/Ø�Ü5Ø ØØÜ)ØôˆHð Ð#Ð- XÓ-Ð#Ø!ˆŒØ�‰�N HÔ-ØˆøôC ò 9à"×+Ñ+Ð,?Ó@�Ø—‘ 5°4�Ö8ð9ús   Ã!F8 Æ8-G(Ç'G(r.   )r4   r#   r5   r'   r6   r)   r8   r#   r,   ÚboolÚreturnÚNone)rF   r   r,   rs   rt   r"   )rO   r2   rt   r2   )T)rO   r2   rZ   rs   rt   r   )rt   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r:   ÚclassmethodrI   rP   rW   rL   © r;   r9   r"   r"   )   s¸   … ñð !Ó àƒKØÓØÓØ$Ó$ð !%ð"ð  ñ"à#ð"ð ð"ð (ð	"ð ð"ð ð"ð 
ó"ð. ð
  ñ	
àð
ð ð	
ð
 
ò
ó ð
ó>ôô09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ÚImportErrorrh   ÚKeyError)r~   s    r9   rg   rg   È   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"   rI   Úsetattr)rF   Úmprƒ   s      r9   Úpytest_configurer‰   Ô   sI   € ô 
‹€BØ
×Ñ�r—w‘wÔÜ'×3Ñ3°FÀdÐ3ÓKÐØ‡J�JˆvÐ*Ð,=Àu€JÕMr;   c                óT   — | j                  ddd¬«       | j                  ddd¬«       y )Nr=   zfHow many sessions should we keep the `tmp_path` directories, according to `tmp_path_retention_policy`.é   )ÚhelpÚdefaultr?   zvControls which directories created by the `tmp_path` fixture are kept around, based on test outcome. (all/failed/none)r   )Úaddini)Úparsers    r9   Úpytest_addoptionr�   á   s:   € Ø
‡M�MØ"ØuØð ô ð ‡M�MØ#ðàð	 õ r;   Úsession)Úscopec                ó.   — | j                   j                  S )zGReturn a :class:`pytest.TempPathFactory` instance for the test session.)rF   rƒ   )Úrequests    r9   Útmp_path_factoryr•   ð   s   € ð �>‰>×+Ñ+Ð+r;   c                ó�   — | j                   j                  }t        j                  dd|«      }d}|d | }|j	                  |d¬«      S )Nz[\W]Ú_é   T)rZ   )ÚnodeÚnameÚreÚsubrW   )r”   Úfactoryrš   ÚMAXVALs       r9   Ú_mk_tmprŸ   ÷   sF   € Ø�<‰<×Ñ€DÜ�6‰6�'˜3 Ó%€DØ€FØ��ˆ=€DØ�>‰>˜$¨ˆ>Ó.Ð.r;   c              #  ó<  K  — t        | |«      }|–— | j                  j                  j                  }|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‘   rF   rƒ   r*   r™   ÚstashÚtmppath_result_keyrD   r   )r”   r•   r0   rH   Úresult_dicts        r9   Útmp_pathr§   ÿ   s†   è ø€ ô �7Ð,Ó-€DØ
‚Jð )0¯©×(>Ñ(>×(PÑ(PÐØ×/Ñ/€FØ—,‘,×$Ñ$Ô%7Ñ8€Kà�Ò˜kŸo™o¨f°dÔ;ô 	ˆt 4Õ(à�‰×ÑÔ-Ñ.ùs   ‚BBc                ó  — | j                   j                  }|j                  }|€y|j                  }|dk(  r.|dk(  r)|j                  €|j                  «       rt        |d¬«       |j                  «       rt        |«       y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¢   )rF   rƒ   r&   r*   r$   Úis_dirr   r   )r‘   Ú
exitstatusr•   r8   rH   s        r9   Úpytest_sessionfinishr«     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       r9   Úpytest_runtest_makereportrµ   2  sK   è ø€ ò €CØ�8‰8ÐÐÐØ€EØADÇÁ€D‡J�J×ÑÔ,¨eÓ4°S·X±XÑ>Ø€Jùs   ‚AA)rt   z
str | None)rF   r   rt   ru   )r�   r   rt   ru   )r”   r   rt   r"   )r”   r   r�   r"   rt   r   )r”   r   r•   r"   rt   zGenerator[Path])rª   zint | ExitCode)r²   r   rt   z'Generator[None, TestReport, TestReport])9ry   Ú
__future__r   Údataclassesr/   Úpathlibr   r›   Úshutilr   re   Ú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   r2   rs   r¥   r)   Ú	dataclassr"   rg   r‰   r�   r•   rŸ   r§   r«   rµ   r|   r;   r9   Ú<module>rÅ      s9  ðá Då "ã Û 	Ý Û 	Ý Û Ý Ý Ý Ý Ý å *Ý !Ý &Ý 3Ý Ý &Ý !Ý #Ý #Ý ,Ý -Ý $Ý +Ý +Ý Ý &Ý "ð /�X˜d 3¨ 9™oÑ.Ó0Ð ØÐ/Ñ0€ð Ø×Ñ÷Zð Zó ó ðZóz	ó
Nóñ 	ˆyÔò,ó ð,ó/ð 	ð/Øð/Ø/>ð/àò/ó 	ð/ó2(ñ2 
�$ Ô&ðØ
ðà,òó 'ñr;   