§
    öyIfÓ-  ã            
       ó   — d 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& 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!ee+         fd"„Z1d#ed!dfd$„Z2d%ed!dfd&„Z3 e!d'¬(¦  «        d)e"d!e0fd*„¦   «         Z4d)e"d+e0d!efd,„Z5e!d)e"d-e0d!eeddf         fd.„¦   «         Z6d/ee7ef         fd0„Z8 ed1d1¬2¦  «        d3e&d!ede(e(f         fd4„¦   «         Z9dS )5z>Support for providing temporary directories to test functions.é    N)ÚPath)Úrmtree)ÚAny)ÚDict)Úfinal)Ú	Generator)ÚLiteral)ÚOptional)ÚUnioné   )Ú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ee         ed<   eed<   ee         ed<   eed<   e	ed<   	 ddd	œd
ee         dede	dee         de
ddfd„Zedd	œdede
dd fd„¦   «         Zdedefd„Zddede
defd„Zdefd„ZdS )ÚTempPathFactoryz—Factory for temporary directories under the common base temp directory.

    The base directory can be configured using the ``--basetemp`` option.
    Ú_given_basetempÚ_traceÚ	_basetempÚ_retention_countÚ_retention_policyNF©Ú	_ispytestÚgiven_basetempÚretention_countÚretention_policyÚbasetempr*   Úreturnc                óì   — t          |¦  «         |€d | _        n>t          t          j                             t          |¦  «        ¦  «        ¦  «        | _        || _        || _        || _	        || _
        d S ©N)r   r$   r   ÚosÚpathÚabspathÚstrr%   r'   r(   r&   )Úselfr+   r,   r-   Útracer.   r*   s          úB/var/www/piapp/venv/lib/python3.11/site-packages/_pytest/tmpdir.pyÚ__init__zTempPathFactory.__init__8   sm   € õ 	�yÑ!Ô!Ð!ØÐ!Ø#'ˆDÔ Ð õ
 $(­¬¯ª½¸NÑ8KÔ8KÑ(LÔ(LÑ#MÔ#MˆDÔ ØˆŒØ /ˆÔØ!1ˆÔØ!ˆŒˆˆó    Úconfigc                ó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+   r7   r,   r-   r*   )r   ÚintÚgetiniÚ
ValueErrorÚoptionr.   r7   Úget)Úclsr;   r*   ÚcountÚpolicys        r8   Úfrom_configzTempPathFactory.from_configO   sÕ   € õ 	�yÑ!Ô!Ð!Ý�F—M’MÐ"<Ñ=Ô=Ñ>Ô>ˆØ�1Š9ˆ9ÝØQÈÐQÐQÐQñô ð ð —’Ð:Ñ;Ô;ˆØÐ2Ð2Ð2ÝØgÐ^dÐgÐgÐgñô ð ð ˆsØ!œ=Ô1Ø”,×"Ò" 8Ñ,Ô,Ø!Ø#Øð
ñ 
ô 
ð 	
r:   Úbasenamec                 óð   — t           j                             |¦  «        }|                      ¦   «         |z                       ¦   «         j        |                      ¦   «         k    rt          |› d�¦  «        ‚|S )Nz& is not a normalized and relative path)r2   r3   ÚnormpathÚgetbasetempÚresolveÚparentrC   )r6   rJ   s     r8   Ú_ensure_relative_to_basetempz,TempPathFactory._ensure_relative_to_basetempo   sj   € Ý”7×#Ò# HÑ-Ô-ˆØ×ÒÑÔ Ñ)×2Ò2Ñ4Ô4Ô;¸t×?OÒ?OÑ?QÔ?QÒQÐQÝ ÐPÐPÐPÑQÔQÐQØˆr:   TÚnumberedc                 ó$  — |                       |¦  «        }|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ÚprefixrU   Úmktemp)rP   rM   ÚjoinpathÚmkdirr   r%   )r6   rJ   rQ   Úps       r8   rX   zTempPathFactory.mktempu   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¬¦  «         |                     ¦   «         }�njt          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          ¦   «         }|�]|                     ¦   «         }|j        |k    rt          d
|› d�¦  «        ‚|j        dz  dk    rt          j        ||j        dz  ¦  «         | j        }| j        dk    rd}t-          d||t.          d¬¦  «        }|€
J |¦   «         ‚|| _         |                      d|¦  «         |S )z�Return the base temporary directory, creating it if needed.

        :returns:
            The base temporary directory.
        NrS   rT   ÚPYTEST_DEBUG_TEMPROOTÚunknownz
pytest-of-T)rU   Ú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-)rW   rV   ÚkeepÚlock_timeoutrU   znew basetemp)r&   r$   Úexistsr   rZ   rN   r2   ÚenvironrE   r   ÚtempfileÚ
gettempdirÚget_userrY   ÚOSErrorr   ÚstatÚst_uidÚst_modeÚchmodr'   r(   r   r   r%   )	r6   r.   Úfrom_envÚtemprootÚuserÚrootdirÚuidÚrootdir_statra   s	            r8   rM   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ØˆØ&Ÿ|š|™~œ~�ØÔ&¨#Ò-Ð-Ý!ð2°7ð 2ð 2ð 2ñô ð ð !Ô(¨5Ñ0°QÒ6Ð6Ý”H˜W lÔ&:¸VÑ&CÑDÔDÐDØÔ(ˆDØÔ%¨Ò/Ð/Ø�Ý5Ø ØØÝ)Øðñ ô ˆHð Ð#Ð# XÑ#Ô#Ð#Ø!ˆŒØ�Š�N HÑ-Ô-Ð-Øˆs   Ã(D  Ä 6D9Ä8D9r1   )T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   r   Ú__annotations__r   rA   ÚRetentionTypeÚboolr9   Úclassmethodr   rI   r5   rP   rX   rM   © r:   r8   r#   r#   )   sˆ  € € € € € € ðð ð
 ˜d”^Ð#Ð#Ñ#à€K€K�KØ˜Œ~ÐÐÑØÐÐÑØ$Ð$Ð$Ñ$ð $(ð"ð  ð"ð "ð "à  œð"ð ð"ð (ð	"ð ˜4”.ð"ð ð"ð 
ð"ð "ð "ð "ð. ð
  ð	
ð 
ð 
àð
ð ð	
ð
 
ð
ð 
ð 
ñ „[ð
ð>°Sð ¸Sð ð ð ð ðð ˜sð ¨dð ¸dð ð ð ð ð09˜Tð 9ð 9ð 9ð 9ð 9ð 9r:   r#   r/   c                  ó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ÚImportErrorrh   ÚKeyError)r}   s    r8   rg   rg   É   sI   € ðàˆˆˆà�ŠÑ Ô Ð øÝ�¥(Ð+ð ð ð Øˆtˆtðøøøs   ‚ š5´5r;   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#   rI   Úsetattr)r;   Úmpr‚   s      r8   Úpytest_configurerˆ   Õ   s^   € õ 
‰Œ€BØ
×Ò�r”wÑÔÐÝ'×3Ò3°FÀdÐ3ÑKÔKÐØ‡J‚JˆvÐ*Ð,=Àu€JÑMÔMÐMÐMÐMr:   Úparserc                 óf   — |                       ddd¬¦  «         |                       ddd¬¦  «         d S )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)r‰   s    r8   Úpytest_addoptionr�   â   sX   € Ø
‡M‚MØ"ØuØð ñ ô ð ð ‡M‚MØ#ðàð	 ñ ô ð ð ð r:   Úsession)ÚscopeÚrequestc                 ó   — | j         j        S )zGReturn a :class:`pytest.TempPathFactory` instance for the test session.)r;   r‚   )r’   s    r8   Útmp_path_factoryr”   ñ   s   € ð Œ>Ô+Ð+r:   Úfactoryc                 óŒ   — | j         j        }t          j        dd|¦  «        }d}|d |…         }|                     |d¬¦  «        S )Nz[\W]Ú_é   T)rQ   )ÚnodeÚnameÚreÚsubrX   )r’   r•   rš   ÚMAXVALs       r8   Ú_mk_tmprž   ø   sG   € ØŒ<Ô€DÝŒ6�'˜3 Ñ%Ô%€DØ€FØ���Œ=€DØ�>Š>˜$¨ˆ>Ñ.Ô.Ð.r:   r”   c              #   ó  K  — t          | |¦  «        }|V — | j        j        j        }|j        }| j        j        t                   }|dk    r'|                     dd¦  «        rt          |d¬¦  «         | j        j        t          = dS )ag  Return a temporary directory path object which is unique to each test
    function invocation, created as a sub directory of the base temporary
    directory.

    By default, a new base temporary directory is created each test session,
    and old bases are removed after 3 sessions, to aid in debugging.
    This behavior can be configured with :confval:`tmp_path_retention_count` and
    :confval:`tmp_path_retention_policy`.
    If ``--basetemp`` is used then it is cleared each session. See
    :ref:`temporary directory location and retention`.

    The returned object is a :class:`pathlib.Path` object.
    r    ÚcallT©Úignore_errorsN)
rž   r�   r;   r‚   r(   r™   ÚstashÚtmppath_result_keyrE   r   )r’   r”   r3   rH   Úresult_dicts        r8   Útmp_pathr¦      s�   è è € õ" �7Ð,Ñ-Ô-€DØ
€J€J€Jð )0¬Ô(>Ô(PÐØÔ/€FØ”,Ô$Õ%7Ô8€Kà�ÒÐ˜kŸošo¨f°dÑ;Ô;Ðõ 	ˆt 4Ð(Ñ(Ô(Ð(àŒÔÕ-Ð.Ð.Ð.r:   Ú
exitstatusc                 óü   — | j         j        }|j        }|€dS |j        }|dk    r2|dk    r,|j        €%|                     ¦   «         rt          |d¬¦  «         |                     ¦   «         rt          |¦  «         dS 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�   r§   r”   r.   rH   s        r8   Úpytest_sessionfinishrª   !  s    € ð )0¬Ô(HÐØÔ)€HØÐØˆàÔ/€Fà�aŠˆØ�hÒÐØÔ,Ð4à�?Š?ÑÔð 	1õ �8¨4Ð0Ñ0Ô0Ð0ð ‡‚ÑÔð (Ý˜hÑ'Ô'Ð'Ð'Ð'ð(ð (r:   T)ÚwrapperÚtryfirstÚitemc              #   ó‚   K  — d V —}|j         €J ‚i }|j        | j                             t          |¦  «        |j         <   |S r1   )ÚwhenÚpassedr£   Ú
setdefaultr¤   )r­   r    ÚrepÚemptys       r8   Úpytest_runtest_makereportr´   :  sJ   è è € ð ˆ%ˆ%€CØŒ8ÐÐÐØ€EØADÄ€D„J×ÒÕ,¨eÑ4Ô4°S´XÑ>Ø€Jr:   ):rv   Údataclassesr2   Úpathlibr   r›   Úshutilr   re   Útypingr   r   r   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   r5   ry   r¤   rx   Ú	dataclassr#   rg   rˆ   r�   r”   rž   r¦   rA   rª   r´   r{   r:   r8   ú<module>rÃ      s  ðà DÐ Dà Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø €€€Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à *Ð *Ð *Ð *Ð *Ð *Ø !Ð !Ð !Ð !Ð !Ð !Ø &Ð &Ð &Ð &Ð &Ð &Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ø !Ð !Ð !Ð !Ð !Ð !Ø #Ð #Ð #Ð #Ð #Ð #Ø #Ð #Ð #Ð #Ð #Ð #Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø -Ð -Ð -Ð -Ð -Ð -Ø $Ð $Ð $Ð $Ð $Ð $Ø +Ð +Ð +Ð +Ð +Ð +Ø +Ð +Ð +Ð +Ð +Ð +Ø Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ø "Ð "Ð "Ð "Ð "Ð "ð /�X˜d 3¨ 9œoÔ.Ñ0Ô0Ð ØÐ/Ô0€ð ØÔð[ð [ð [ð [ð [ñ [ô [ñ Ôñ „ð[ð|	�(˜3”-ð 	ð 	ð 	ð 	ð
N˜Vð 
N¨ð 
Nð 
Nð 
Nð 
Nð˜Vð ¨ð ð ð ð ð 	€ˆyÐÑÔð,˜nð ,°ð ,ð ,ð ,ñ Ôð,ð/�^ð /¨oð /À$ð /ð /ð /ð /ð 	ð/Øð/Ø/>ð/àˆt�T˜4ÐÔ ð/ð /ð /ñ 	„ð/ð@(¨e°C¸°MÔ.Bð (ð (ð (ð (ð2 
€�$ Ð&Ñ&Ô&ðØ
ðàˆt�Z Ð+Ô,ðð ð ñ 'Ô&ðð ð r:   