§
    øÛg  ã                   ó¬   — d Z ddlZddlZddlZddlmZ  G d„ d¦  «        Zd„ ZeZd„ Z	 ej
        d¬	¦  «        d
„ ¦   «         Zej
        d„ ¦   «         ZdS )zA support for providing temporary directories to test functions.  é    N)ÚMonkeyPatchc                   ó4   — e Zd ZdZd„ Zd
d„Zdd„Zd„ Zd„ Zd	S )ÚTempdirFactoryz—Factory for temporary directories under the common base temp directory.

    The base directory can be configured using the ``--basetemp`` option.
    c                 óR   — || _         |j                             d¦  «        | _        d S )NÚtmpdir)ÚconfigÚtraceÚget)Úselfr   s     úD/granary/edev/quantum/lib/python3.11/site-packages/_pytest/tmpdir.pyÚ__init__zTempdirFactory.__init__   s$   € ØˆŒØ”\×%Ò% hÑ/Ô/ˆŒ
ˆ
ˆ
ó    é   c                 óT   — |                       ¦   «                              ||¬¦  «        S )a*   (deprecated) return temporary directory path with
            the given string as the trailing part.  It is usually
            better to use the 'tmpdir' function argument which
            provides an empty unique-per-test-invocation directory
            and is guaranteed to be empty.
        ©Údir)ÚgetbasetempÚensure)r   Ústringr   s      r   Ú
ensuretempzTempdirFactory.ensuretemp   s)   € ð ×ÒÑ!Ô!×(Ò(¨°SÐ(Ñ9Ô9Ð9r   Tc                 óÚ   — |                       ¦   «         }|s|                     |¦  «        }n(t          j        j                             |d|d¬¦  «        }|                      d|¦  «         |S )zÆCreate a subdirectory of the base temporary directory and return it.
        If ``numbered``, ensure the directory is unique by adding a number
        prefix greater than any existing one.
        r   N)ÚprefixÚkeepÚrootdirÚlock_timeoutÚmktemp)r   ÚmkdirÚpyÚpathÚlocalÚmake_numbered_dirr	   )r   ÚbasenameÚnumberedÚbasetempÚps        r   r   zTempdirFactory.mktemp   sp   € ð
 ×#Ò#Ñ%Ô%ˆØð 	=Ø—’˜xÑ(Ô(ˆAˆAå””×/Ò/°xØ °tð 0ñ =ô =ˆAà�
Š
�8˜QÑÔÐØˆr   c                 óŒ  — 	 | j         S # t          $ �r/ | j        j        j        }|r\t
          j                             |¦  «        }|                     ¦   «         r| 	                    ¦   «          | 
                    ¦   «          nŠt
          j        j                             ¦   «         }t          ¦   «         }|r|                     d|z  ¦  «        }n|}|                     d¬¦  «         t
          j        j                             d|¬¦  «        }|                     ¦   «         x| _         }|                      d|¦  «         |cY S w xY w)z" return base temporary directory. zpytest-of-%sr   r   zpytest-)r   r   znew basetemp)Ú	_basetempÚAttributeErrorr   Úoptionr$   r   r   r    ÚcheckÚremover   Úget_temprootÚget_userÚjoinr   r!   Úrealpathr	   )r   r$   ÚtemprootÚuserr   Úts         r   r   zTempdirFactory.getbasetemp+   s;  € ð	Ø”>Ð!øÝð 	ñ 	ð 	Ø”{Ô)Ô2ˆHØð LÝœ7Ÿ=š=¨Ñ2Ô2�Ø—>’>Ñ#Ô#ð &Ø—O’OÑ%Ô%Ð%Ø—’Ñ Ô Ð Ð åœ7œ=×5Ò5Ñ7Ô7�Ý‘z”z�Øð 'ð 'Ÿmšm¨N¸TÑ,AÑBÔB�G�Gà&�GØ—’ 1�Ñ%Ô%Ð%Ýœ7œ=×:Ò:À)ØCJð ;ñ Lô L�à!)×!2Ò!2Ñ!4Ô!4Ð4ˆDŒN˜QØ�JŠJ�~ qÑ)Ô)Ð)ØˆHˆHˆHð+	øøøs   ‚	 ‰D7EÅEc                 ó0   — |                       d¦  «         d S )NÚfinish)r	   )r   s    r   r4   zTempdirFactory.finishF   s   € Ø�
Š
�8ÑÔÐÐÐr   N)r   )T)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r4   © r   r   r   r   	   ss   € € € € € ðð ð
0ð 0ð 0ð:ð :ð :ð :ðð ð ð ðð ð ð6ð ð ð ð r   r   c                  ód   — ddl } 	 |                      ¦   «         S # t          t          f$ r Y dS w xY w)zqReturn the current user name, or None if getuser() does not work
    in the current environment (see #1010).
    r   N)ÚgetpassÚgetuserÚImportErrorÚKeyError)r;   s    r   r-   r-   J   sI   € ð €N€N€NðØ�ŠÑ Ô Ð øÝ�Ð"ð ð ð Øˆtˆtðøøøs   † š/®/c                 ó  — t          ¦   «         }t          | ¦  «        }| j                             |j        |j        g¦  «         |                     | d|d¬¦  «         |                     t          d|j        d¬¦  «         dS )a  Create a TempdirFactory 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 tmpdir_factory session fixture.
    Ú_tmpdirhandlerF)Úraisingr   N)	r   r   Ú_cleanupÚextendÚundor4   ÚsetattrÚpytestr   )r   Úmpr2   s      r   Úpytest_configurerH   X   sv   € õ 
‰Œ€BÝ�vÑÔ€AØ
„O×Ò˜BœG Q¤XÐ.Ñ/Ô/Ð/Ø‡J‚JˆvÐ'¨°E€JÑ:Ô:Ð:Ø‡J‚J�v�| Q¤\¸5€JÑAÔAÐAÐAÐAr   Úsession)Úscopec                 ó   — | j         j        S )z;Return a TempdirFactory instance for the test session.
    )r   r@   )Úrequests    r   Útmpdir_factoryrM   f   s   € ð Œ>Ô(Ð(r   c                 ó¶   — | j         j        }t          j        dd|¦  «        }d}t	          |¦  «        |k    r
|d|…         }|                     |d¬¦  «        }|S )zãReturn a temporary directory path object
    which is unique to each test function invocation,
    created as a sub directory of the base temporary
    directory.  The returned object is a `py.path.local`_
    path object.
    z[\W]Ú_é   NT)r#   )ÚnodeÚnameÚreÚsubÚlenr   )rL   rM   rR   ÚMAXVALÚxs        r   r   r   m   sa   € ð Œ<Ô€DÝŒ6�&˜#˜tÑ$Ô$€DØ€FÝ
ˆ4�y„y�6ÒÐØ�G�V�GŒ}ˆØ×Ò˜d¨TÐÑ2Ô2€AØ€Hr   )r8   rS   rF   r   Ú_pytest.monkeypatchr   r   r-   ÚTempdirHandlerrH   ÚfixturerM   r   r9   r   r   ú<module>r[      sÛ   ðØ GÐ GØ 	€	€	€	à €€€Ø 	€	€	€	Ø +Ð +Ð +Ð +Ð +Ð +ð>ð >ð >ð >ð >ñ >ô >ð >ðBð ð ð  €ðBð Bð Bð €„�iÐ Ñ Ô ð)ð )ñ !Ô ð)ð „ðð ñ „ðð ð r   