§
    s
Êj×3  ã                  ó„  — 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.  e.e/e0e1f                  ¦   «         Z2ed         Z3eej4         G d„ d¦  «        ¦   «         ¦   «         Z5d>d"„Z6d?d&„Z7d@d)„Z8 e%d*¬+¦  «        dAd.„¦   «         Z9dBd1„Z:e%dCd4„¦   «         Z;dDd7„Z< ed8d8¬9¦  «        dEd=„¦   «         Z=dS )Fz>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                  ó�   — 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S ))Ú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©Ú	_ispytestÚgiven_basetempÚretention_countÚretention_policyÚbasetempr,   ÚboolÚreturnÚNonec               ó  — t          |¦  «         |€d | _        n>t          t          j                             t          |¦  «        ¦  «        ¦  «        | _        || _        || _        || _	        || _
        t          ¦   «         | _        d S ©N)r   r$   r   ÚosÚpathÚabspathÚstrr%   r(   r*   r&   r   Ú_exit_stack)Úselfr-   r.   r/   Útracer0   r,   s          ú>C:\Projects\Muse2API\.venv\Lib\site-packages\_pytest/tmpdir.pyÚ__init__zTempPathFactory.__init__9   s}   € õ 	�yÑ!Ô!Ð!ØÐ!Ø#'ˆDÔ Ð õ
 $(­¬¯ª½¸NÑ8KÔ8KÑ(LÔ(LÑ#MÔ#MˆDÔ ØˆŒØ /ˆÔØ!1ˆÔØ!ˆŒõ %™;œ;ˆÔÐÐó    Úconfigr   c               óR  — t          |¦  «         t          |                     d¦  «        ¦  «        }|dk     rt          d|› d�¦  «        ‚|                     d¦  «        }|dvrt          d|› d�¦  «        ‚ | |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)r-   r<   r.   r/   r,   )r   r'   ÚgetiniÚ
ValueErrorÚoptionr0   r<   Úget)Úclsr@   r,   ÚcountÚpolicys        r=   Úfrom_configzTempPathFactory.from_configS   sÕ   € õ 	�yÑ!Ô!Ð!Ý�F—M’MÐ"<Ñ=Ô=Ñ>Ô>ˆØ�1Š9ˆ9ÝØQÈÐQÐQÐQñô ð ð —’Ð:Ñ;Ô;ˆØÐ2Ð2Ð2ÝØgÐ^dÐgÐgÐgñô ð ð ˆsØ!œ=Ô1Ø”,×"Ò" 8Ñ,Ô,Ø!Ø#Øð
ñ 
ô 
ð 	
r?   Úbasenamer9   c                óð   — t           j                             |¦  «        }|                      ¦   «         |z                       ¦   «         j        |                      ¦   «         k    rt          |› d�¦  «        ‚|S )Nz& is not a normalized and relative path)r6   r7   ÚnormpathÚgetbasetempÚresolveÚparentrG   )r;   rN   s     r=   Ú_ensure_relative_to_basetempz,TempPathFactory._ensure_relative_to_basetemps   sj   € Ý”7×#Ò# HÑ-Ô-ˆØ×ÒÑÔ Ñ)×2Ò2Ñ4Ô4Ô;¸t×?OÒ?OÑ?QÔ?QÒQÐQÝ ÐPÐPÐPÑQÔQÐQØˆr?   TÚnumberedr   c                ó$  — |                       |¦  «        }|s>|                      ¦   «                              |¦  «        }|                     d¬¦  «         n:t	          |                      ¦   «         |d¬¦  «        }|                      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ÚprefixrY   Úmktemp)rT   rQ   ÚjoinpathÚmkdirr   r%   )r;   rN   rU   Úps       r=   r\   zTempPathFactory.mktempy   s�   € ð ×4Ò4°XÑ>Ô>ˆØð 	%Ø× Ò Ñ"Ô"×+Ò+¨HÑ5Ô5ˆAØ�GŠG˜ˆGÑÔÐÐå! t×'7Ò'7Ñ'9Ô'9À(ÐQVÐWÑWÔWˆAØ�KŠK˜ !Ñ$Ô$Ð$Øˆr?   c                ó‚  — | j         �| j         S | j        �V| j        }|                     ¦   «         rt          |¦  «         |                     d¬¦  «         |                     ¦   «         }�n*t          j                             d¦  «        }t          |pt          j        ¦   «         ¦  «                             ¦   «         }t          ¦   «         pd}|                     d|› �¦  «        }	 |                     dd¬¦  «         n<# t          $ r/ |                     d	¦  «        }|                     dd¬¦  «         Y nw xY wt          ¦   «         }|�Åt          j        t          j        v rd
nd}|                     |¬¦  «        }t!          j        |j        ¦  «        rt          d|› d�¦  «        ‚|j        |k    rt          d|› d�¦  «        ‚|j        dz  dk    r;t          j        t          j        v rd
nd}	|                     |j        dz  |	¬¦  «         | j        }
| j        dk    rd}
t1          d||
t2          d| j        j        ¬¦  «        }t9          j        | j        j        ¦  «         | j                             t8          j        | j        j        ¦  «         |€
J |¦   «         ‚|| _         |                       d|¦  «         |S )z�Return the base temporary directory, creating it if needed.

        :returns:
            The base temporary directory.
        NrW   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^   rR   r6   ÚenvironrI   r   ÚtempfileÚ
gettempdirÚget_userr]   ÚOSErrorr   ÚstatÚsupports_follow_symlinksÚS_ISLNKÚst_modeÚst_uidÚchmodr(   r*   r   r   r:   ÚcallbackÚatexitrh   ÚcloseÚ
unregisterr%   )r;   r0   Úfrom_envÚtemprootÚuserÚrootdirÚuidÚstat_follow_symlinksÚrootdir_statÚchmod_follow_symlinksrf   s              r=   rQ   zTempPathFactory.getbasetemp‘   s  € ð Œ>Ð%Ø”>Ð!àÔÐ+ØÔ+ˆHØ�ŠÑ Ô ð  Ý�h‘”�Ø�NŠN ˆNÑ&Ô&Ð&Ø×'Ò'Ñ)Ô)ˆH‰Hå”z—~’~Ð&=Ñ>Ô>ˆHÝ˜HÐ=­Ô(;Ñ(=Ô(=Ñ>Ô>×FÒFÑHÔHˆHÝ‘:”:Ð* ˆDð ×'Ò'Ð(;°TÐ(;Ð(;Ñ<Ô<ˆGð9Ø—’ 5°4�Ñ8Ô8Ð8Ð8øÝð 9ð 9ð 9à"×+Ò+Ð,?Ñ@Ô@�Ø—’ 5°4�Ñ8Ô8Ð8Ð8Ð8ð9øøøõ" ‘-”-ˆCØˆåœW­Ô(CÐCÐC�E�EÈð %ð  'Ÿ|š|Ð<P˜|ÑQÔQ�Ý”< Ô 4Ñ5Ô5ð Ý!ð2°7ð 2ð 2ð 2ñô ð ð  Ô&¨#Ò-Ð-Ý!ð2°7ð 2ð 2ð 2ñô ð ð !Ô(¨5Ñ0°QÒ6Ð6å!#¤­RÔ-HÐ!HÐ!H˜˜Èdð *ð —M’MØ$Ô,¨vÑ5Ø(=ð "ñ ô ð ð Ô(ˆDØÔ%¨Ò/Ð/Ø�Ý5Ø ØØÝ)ØØÔ)Ô2ðñ ô ˆHõ ŒO˜DÔ,Ô2Ñ3Ô3Ð3ØÔ×%Ò%¥fÔ&7¸Ô9IÔ9OÑPÔPÐPØÐ#Ð# XÑ#Ô#Ð#Ø!ˆŒØ�Š�N HÑ-Ô-Ð-Øˆs   Ã(D  Ä 6D9Ä8D9r5   )r-   r#   r.   r'   r/   r)   r0   r#   r,   r1   r2   r3   )r@   r   r,   r1   r2   r"   )rN   r9   r2   r9   )T)rN   r9   rU   r1   r2   r   )r2   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r>   ÚclassmethodrM   rT   r\   rQ   © r?   r=   r"   r"   +   sþ   € € € € € € ðð ð !Ð Ð Ñ à€K€K�KØÐÐÑØÐÐÑØ$Ð$Ð$Ñ$ð !%ð'ð  ð'ð 'ð 'ð 'ð 'ð 'ð4 ð
  ð	
ð 
ð 
ð 
ð 
ñ „[ð
ð>ð ð ð ðð ð ð ð ð0Tð Tð Tð Tð Tð Tr?   r"   r2   ú
str | Nonec                 óp   — 	 ddl } |                      ¦   «         S # t          t          t          f$ r Y dS 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ÚImportErrorrn   ÚKeyError)rŠ   s    r=   rm   rm   è   sI   € ðàˆˆˆà�ŠÑ Ô Ð øÝ�¥(Ð+ð ð ð Øˆtˆtðøøøs   ‚ š5´5r@   r   r3   c                óÀ   — t          ¦   «         }|                      |j        ¦  «         t                               | d¬¦  «        }|                     | d|d¬¦  «         dS )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"   rM   Úsetattr)r@   Úmpr�   s      r=   Úpytest_configurer•   ô   s^   € õ 
‰Œ€BØ
×Ò�r”wÑÔÐÝ'×3Ò3°FÀdÐ3ÑKÔKÐØ‡J‚JˆvÐ*Ð,=Àu€JÑMÔMÐMÐMÐMr?   Úparserr   c                ój   — |                       dddd¬¦  «         |                       dddd¬	¦  «         d S )
NrB   zfHow many sessions should we keep the `tmp_path` directories, according to `tmp_path_retention_policy`.Ú3Ústring)ÚhelpÚdefaultÚtyperD   zvControls which directories created by the `tmp_path` fixture are kept around, based on test outcome. (all/failed/none)r   )rš   rœ   r›   )Úaddini)r–   s    r=   Úpytest_addoptionrž     s^   € Ø
‡M‚MØ"ØuØàð ñ ô ð ð ‡M‚MØ#ðàØð ñ ô ð ð ð r?   Úsession)ÚscopeÚrequestr   c                ó   — | j         j        S )zGReturn a :class:`pytest.TempPathFactory` instance for the test session.)r@   r�   )r¡   s    r=   Útmp_path_factoryr£     s   € ð Œ>Ô+Ð+r?   Úfactoryr   c                óŒ   — | j         j        }t          j        dd|¦  «        }d}|d |…         }|                     |d¬¦  «        S )Nz[\W]Ú_é   T)rU   )ÚnodeÚnameÚreÚsubr\   )r¡   r¤   r©   ÚMAXVALs       r=   Ú_mk_tmpr­     sG   € ØŒ<Ô€DÝŒ6�'˜3 Ñ%Ô%€DØ€FØ���Œ=€DØ�>Š>˜$¨ˆ>Ñ.Ô.Ð.r?   r£   úGenerator[Path]c              #  óì   K  — t          | |¦  «        }|V — |j        }| j        j        t                   }|dk    r'|                     dd¦  «        rt          |d¬¦  «         | j        j        t          = dS )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_keyrI   r   )r¡   r£   r7   rL   Úresult_dicts        r=   Útmp_pathr¶   "  s‚   è è € õ �7Ð,Ñ-Ô-€DØ
€J€J€Jð Ô/€FØ”,Ô$Õ%7Ô8€Kà�ÒÐ˜kŸošo¨f°dÑ;Ô;Ðõ 	ˆt 4Ð(Ñ(Ô(Ð(àŒÔÕ-Ð.Ð.Ð.r?   Ú
exitstatusúint | ExitCodec                ó*  — | j         j        }|j        }|€dS |j        }|dk    r2|dk    r,|j        €%|                     ¦   «         rt          |d¬¦  «         |                     ¦   «         rt          |¦  «         |j         	                    ¦   «          dS )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±   )
r@   r�   r&   r*   r$   Úis_dirr   r   r:   rw   )rŸ   r·   r£   r0   rL   s        r=   Úpytest_sessionfinishr»   ;  s­   € ð )0¬Ô(HÐØÔ)€HØÐØˆàÔ/€Fà�aŠˆØ�hÒÐØÔ,Ð4à�?Š?ÑÔð 	1õ �8¨4Ð0Ñ0Ô0Ð0ð ‡‚ÑÔð (Ý˜hÑ'Ô'Ð'ð Ô ×&Ò&Ñ(Ô(Ð(Ð(Ð(r?   T)ÚwrapperÚtryfirstÚitemr   ú'Generator[None, TestReport, TestReport]c              #  ó‚   K  — d V —}|j         €J ‚i }|j        | j                             t          |¦  «        |j         <   |S r5   )ÚwhenÚpassedr³   Ú
setdefaultr´   )r¾   r°   ÚrepÚemptys       r=   Úpytest_runtest_makereportrÆ   W  sJ   è è € ð ˆ%ˆ%€CØŒ8ÐÐÐØ€EØADÄ€D„J×ÒÕ,¨eÑ4Ô4°S´XÑ>Ø€Jr?   )r2   rˆ   )r@   r   r2   r3   )r–   r   r2   r3   )r¡   r   r2   r"   )r¡   r   r¤   r"   r2   r   )r¡   r   r£   r"   r2   r®   )r·   r¸   )r¾   r   r2   r¿   )>r„   Ú
__future__r   rv   Úcollections.abcr   Ú
contextlibr   Údataclassesr6   Úpathlibr   rª   Úshutilr   ro   rk   Ú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   Údictr9   r1   r´   r)   Ú	dataclassr"   rm   r•   rž   r£   r­   r¶   r»   rÆ   r‡   r?   r=   ú<module>rÙ      si  ðà DÐ Dà "Ð "Ð "Ð "Ð "Ð "à €€€Ø %Ð %Ð %Ð %Ð %Ð %Ø  Ð  Ð  Ð  Ð  Ð  Ø Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø €€€Ø €€€Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à *Ð *Ð *Ð *Ð *Ð *Ø !Ð !Ð !Ð !Ð !Ð !Ø &Ð &Ð &Ð &Ð &Ð &Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ø !Ð !Ð !Ð !Ð !Ð !Ø #Ð #Ð #Ð #Ð #Ð #Ø #Ð #Ð #Ð #Ð #Ð #Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø -Ð -Ð -Ð -Ð -Ð -Ø $Ð $Ð $Ð $Ð $Ð $Ø +Ð +Ð +Ð +Ð +Ð +Ø +Ð +Ð +Ð +Ð +Ð +Ø Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ø "Ð "Ð "Ð "Ð "Ð "ð /�X˜d 3¨ 9œoÔ.Ñ0Ô0Ð ØÐ/Ô0€ð ØÔðxð xð xð xð xñ xô xñ Ôñ „ðxðv	ð 	ð 	ð 	ð
Nð 
Nð 
Nð 
Nðð ð ð ð$ 	€ˆyÐÑÔð,ð ,ð ,ñ Ôð,ð/ð /ð /ð /ð 	ð/ð /ð /ñ 	„ð/ð0)ð )ð )ð )ð8 
€�$ Ð&Ñ&Ô&ðð ð ñ 'Ô&ðð ð r?   