§
    4›jî0  ã                  óp  — d 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,e-e.f                  ¦   «         Z/ed         Z0eej1         G d„ d¦  «        ¦   «         ¦   «         Z2d=d!„Z3d>d%„Z4d?d(„Z5 e"d)¬*¦  «        d@d-„¦   «         Z6dAd0„Z7e"dBd3„¦   «         Z8dCd6„Z9 ed7d7¬8¦  «        dDd<„¦   «         Z:dS )Ez>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                  ó�   — 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          |¦  «        ¦  «        ¦  «        | _        || _        || _        || _	        || _
        d S ©N)r   r#   r   ÚosÚpathÚabspathÚstrr$   r'   r)   r%   )Úselfr,   r-   r.   Útracer/   r+   s          úK/home/lighthouse/health/venv/lib/python3.11/site-packages/_pytest/tmpdir.pyÚ__init__zTempPathFactory.__init__7   sm   € õ 	�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Úoptionr/   r:   Úget)Úclsr>   r+   ÚcountÚpolicys        r;   Úfrom_configzTempPathFactory.from_configN   sÕ   € õ 	�yÑ!Ô!Ð!Ý�F—M’MÐ"<Ñ=Ô=Ñ>Ô>ˆØ�1Š9ˆ9ÝØQÈÐQÐQÐQñô ð ð —’Ð:Ñ;Ô;ˆØÐ2Ð2Ð2ÝØgÐ^dÐgÐgÐgñô ð ð ˆsØ!œ=Ô1Ø”,×"Ò" 8Ñ,Ô,Ø!Ø#Øð
ñ 
ô 
ð 	
r=   Úbasenamer8   c                óð   — t           j                             |¦  «        }|                      ¦   «         |z                       ¦   «         j        |                      ¦   «         k    rt          |› d�¦  «        ‚|S )Nz& is not a normalized and relative path)r5   r6   ÚnormpathÚgetbasetempÚresolveÚparentrE   )r9   rL   s     r;   Ú_ensure_relative_to_basetempz,TempPathFactory._ensure_relative_to_basetempn   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ÚprefixrW   Úmktemp)rR   rO   ÚjoinpathÚmkdirr   r$   )r9   rL   rS   Úps       r;   rZ   zTempPathFactory.mktempt   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 |¦   «         ‚|| _         |                      d|¦  «         |S )z�Return the base temporary directory, creating it if needed.

        :returns:
            The base temporary directory.
        NrU   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\   rP   r5   ÚenvironrG   r   ÚtempfileÚ
gettempdirÚget_userr[   ÚOSErrorr   ÚstatÚsupports_follow_symlinksÚS_ISLNKÚst_modeÚst_uidÚchmodr'   r)   r   r   r$   )r9   r/   Úfrom_envÚtemprootÚuserÚrootdirÚuidÚstat_follow_symlinksÚrootdir_statÚchmod_follow_symlinksrd   s              r;   rO   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Ø ØØÝ)Øðñ ô ˆHð Ð#Ð# XÑ#Ô#Ð#Ø!ˆŒØ�Š�N HÑ-Ô-Ð-Øˆs   Ã(D  Ä 6D9Ä8D9r4   )r,   r"   r-   r&   r.   r(   r/   r"   r+   r0   r1   r2   )r>   r   r+   r0   r1   r!   )rL   r8   r1   r8   )T)rL   r8   rS   r0   r1   r   )r1   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r<   ÚclassmethodrK   rR   rZ   rO   © r=   r;   r!   r!   )   sþ   € € € € € € ðð ð !Ð Ð Ñ à€K€K�KØÐÐÑØÐÐÑØ$Ð$Ð$Ñ$ð !%ð"ð  ð"ð "ð "ð "ð "ð "ð. ð
  ð	
ð 
ð 
ð 
ð 
ñ „[ð
ð>ð ð ð ðð ð ð ð ð0Nð Nð Nð Nð Nð Nr=   r!   r1   ú
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ÚImportErrorrk   ÚKeyError)rƒ   s    r;   rj   rj   Ý   sI   € ðàˆˆˆà�ŠÑ Ô Ð øÝ�¥(Ð+ð ð ð Øˆtˆtðøøøs   ‚ š5´5r>   r   r2   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!   rK   Ú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 )
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)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)rS   )ÚnodeÚnameÚreÚsubrZ   )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_keyrG   r   )rš   rœ   r6   rJ   Ú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          |¦  «         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/   rJ   s        r;   Úpytest_sessionfinishr´   0  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 r4   )ÚwhenÚpassedr¬   Ú
setdefaultr­   )r·   r©   ÚrepÚemptys       r;   Úpytest_runtest_makereportr¿   I  sJ   è è € ð ˆ%ˆ%€CØŒ8ÐÐÐØ€EØADÄ€D„J×ÒÕ,¨eÑ4Ô4°S´XÑ>Ø€Jr=   )r1   r�   )r>   r   r1   r2   )r�   r   r1   r2   )rš   r   r1   r!   )rš   r   r�   r!   r1   r   )rš   r   rœ   r!   r1   r§   )r°   r±   )r·   r   r1   r¸   );r}   Ú
__future__r   Úcollections.abcr   Údataclassesr5   Úpathlibr   r£   Úshutilr   rl   rh   Ú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   Údictr8   r0   r­   r(   Ú	dataclassr!   rj   rŽ   r—   rœ   r¦   r¯   r´   r¿   r€   r=   r;   ú<module>rÑ      sN  ðà DÐ Dà "Ð "Ð "Ð "Ð "Ð "à %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø €€€Ø €€€Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à *Ð *Ð *Ð *Ð *Ð *Ø !Ð !Ð !Ð !Ð !Ð !Ø &Ð &Ð &Ð &Ð &Ð &Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ø !Ð !Ð !Ð !Ð !Ð !Ø #Ð #Ð #Ð #Ð #Ð #Ø #Ð #Ð #Ð #Ð #Ð #Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø -Ð -Ð -Ð -Ð -Ð -Ø $Ð $Ð $Ð $Ð $Ð $Ø +Ð +Ð +Ð +Ð +Ð +Ø +Ð +Ð +Ð +Ð +Ð +Ø Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ø "Ð "Ð "Ð "Ð "Ð "ð /�X˜d 3¨ 9œoÔ.Ñ0Ô0Ð ØÐ/Ô0€ð ØÔðoð oð oð oð oñ oô oñ Ôñ „ðoðd	ð 	ð 	ð 	ð
Nð 
Nð 
Nð 
Nðð ð ð ð$ 	€ˆyÐÑÔð,ð ,ð ,ñ Ôð,ð/ð /ð /ð /ð 	ð/ð /ð /ñ 	„ð/ð0(ð (ð (ð (ð2 
€�$ Ð&Ñ&Ô&ðð ð ñ 'Ô&ðð ð r=   