
    9[g@                    n   d 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& ddl$m'Z' ddl(m)Z) ddl*m+Z+ erddl,Z,e
 G d d             Z- G d d      Z.e
ej^                   G d  d!                    Z0 G d" d#      Z1d3d$Z2d4d%Z3d5d&Z4d6d'Z5d6d(Z6d7d)Z7d8d*Z8d9d+Z9d:d,Z:d;d-Z; ed./      d<d0       Z<ed=d1       Z=ed>d2       Z>y)?z?Add backward compatibility support for the legacy py path type.    )annotationsN)Path)Final)final)TYPE_CHECKING)SectionWrapper)Cache)LEGACY_PATHlegacy_path)Config)hookimpl)PytestPluginManager)check_ispytest)fixture)FixtureRequest)Session)MonkeyPatch)	Collector)Item)Node)HookRecorder)Pytester)	RunResult)TerminalReporter)TempPathFactoryc                  R   e Zd ZU dZdZej                  Zded<   ej                  Zded<   ddd9dZ	e
d:d       Ze
d:d	       Ze
d
        Ze
d        Zej                  d        Ze
d;d       Zd<dZd=dZd=dZd:dZd:dZd:dZd>dZd:dZd:dZd:dZd?d=dZd:dZd:dZd?d:dZd@dZd Z dAdZ!d  Z"d! Z#d" Z$d#dd$dBd%Z%dCd&Z&dCd'Z'dDd(Z(dDd)Z)dEd*Z*d+ Z+dFd,Z,dGd-Z-e.j^                  e.j^                  efd.Z0ded/dCd0Z1dCd1Z2d2 Z3dd3dCd4Z4dHdId5Z5dHdJd6Z6dKd7Z7dKd8Z8y)LTestdirz
    Similar to :class:`Pytester`, but this class works with legacy legacy_path objects instead.

    All methods just forward to an internal :class:`Pytester` instance, converting results
    to `legacy_path` objects as necessary.
    Fr   CLOSE_STDINTimeoutExpired	_ispytestc               (    t        |       || _        y N)r   	_pytester)selfpytesterr"   s      M/var/www/html/bid-api/venv/lib/python3.12/site-packages/_pytest/legacypath.py__init__zTestdir.__init__7   s    y!!    c                @    t        | j                  j                        S )z-Temporary directory where tests are executed.)r   r%   pathr&   s    r(   tmpdirzTestdir.tmpdir;   s     4>>..//r*   c                @    t        | j                  j                        S r$   )r   r%   _test_tmprootr-   s    r(   test_tmprootzTestdir.test_tmproot@   s    4>>7788r*   c                .    | j                   j                  S r$   )r%   _requestr-   s    r(   requestzTestdir.requestD   s    ~~&&&r*   c                .    | j                   j                  S r$   r%   pluginsr-   s    r(   r7   zTestdir.pluginsH   s    ~~%%%r*   c                &    || j                   _        y r$   r6   )r&   r7   s     r(   r7   zTestdir.pluginsL   s    !(r*   c                .    | j                   j                  S r$   )r%   _monkeypatchr-   s    r(   monkeypatchzTestdir.monkeypatchP   s    ~~***r*   c                8    | j                   j                  |      S )z(See :meth:`Pytester.make_hook_recorder`.)r%   make_hook_recorder)r&   pluginmanagers     r(   r=   zTestdir.make_hook_recorderT   s    ~~00??r*   c                6    | j                   j                         S )zSee :meth:`Pytester.chdir`.)r%   chdirr-   s    r(   r@   zTestdir.chdirX   s    ~~##%%r*   c                6    | j                   j                         S r$   )r%   	_finalizer-   s    r(   finalizezTestdir.finalize\   s    ~~''))r*   c                    |r|j                  d      sd|z   }t         | j                  j                  |g|i |      S )zSee :meth:`Pytester.makefile`..)
startswithr   r%   makefile)r&   extargskwargss       r(   rG   zTestdir.makefile_   sB    s~~c* )C24>>223HHHIIr*   c                J    t        | j                  j                  |            S )z"See :meth:`Pytester.makeconftest`.)r   r%   makeconftestr&   sources     r(   rL   zTestdir.makeconftestk   s    4>>66v>??r*   c                J    t        | j                  j                  |            S )zSee :meth:`Pytester.makeini`.)r   r%   makeinirM   s     r(   rP   zTestdir.makeinio   s    4>>11&9::r*   c                8    | j                   j                  |      S )zSee :meth:`Pytester.getinicfg`.)r%   	getinicfgrM   s     r(   rR   zTestdir.getinicfgs       ~~''//r*   c                J    t        | j                  j                  |            S )z'See :meth:`Pytester.makepyprojecttoml`.)r   r%   makepyprojecttomlrM   s     r(   rU   zTestdir.makepyprojecttomlw   s    4>>;;FCDDr*   c                L    t         | j                  j                  |i |      S )z See :meth:`Pytester.makepyfile`.)r   r%   
makepyfiler&   rI   rJ   s      r(   rW   zTestdir.makepyfile{   s$    44>>44dEfEFFr*   c                L    t         | j                  j                  |i |      S )z!See :meth:`Pytester.maketxtfile`.)r   r%   maketxtfilerX   s      r(   rZ   zTestdir.maketxtfile   s$    54>>55tFvFGGr*   Nc                8    | j                   j                  |      S )z#See :meth:`Pytester.syspathinsert`.)r%   syspathinsertr&   r,   s     r(   r\   zTestdir.syspathinsert   s    ~~++D11r*   c                J    t        | j                  j                  |            S )zSee :meth:`Pytester.mkdir`.)r   r%   mkdirr&   names     r(   r_   zTestdir.mkdir   s    4>>//566r*   c                J    t        | j                  j                  |            S )zSee :meth:`Pytester.mkpydir`.)r   r%   mkpydirr`   s     r(   rc   zTestdir.mkpydir   s    4>>11$788r*   c                J    t        | j                  j                  |            S )z"See :meth:`Pytester.copy_example`.)r   r%   copy_exampler`   s     r(   re   zTestdir.copy_example   s    4>>66t<==r*   c                :    | j                   j                  ||      S )zSee :meth:`Pytester.getnode`.)r%   getnode)r&   configargs      r(   rg   zTestdir.getnode   s    ~~%%fc22r*   c                8    | j                   j                  |      S )z!See :meth:`Pytester.getpathnode`.)r%   getpathnoder]   s     r(   rk   zTestdir.getpathnode   s    ~~))$//r*   c                8    | j                   j                  |      S )zSee :meth:`Pytester.genitems`.)r%   genitems)r&   colitemss     r(   rm   zTestdir.genitems   s    ~~&&x00r*   c                8    | j                   j                  |      S )zSee :meth:`Pytester.runitem`.)r%   runitemrM   s     r(   rp   zTestdir.runitem   s    ~~%%f--r*   c                <     | j                   j                  |g| S )z&See :meth:`Pytester.inline_runsource`.)r%   inline_runsource)r&   rN   cmdlineargss      r(   rr   zTestdir.inline_runsource   s    .t~~..vDDDr*   c                4     | j                   j                  | S )z%See :meth:`Pytester.inline_genitems`.)r%   inline_genitemsr&   rI   s     r(   ru   zTestdir.inline_genitems   s    -t~~--t44r*    r7   no_reraise_ctrlcc               <     | j                   j                  |||dS )z See :meth:`Pytester.inline_run`.rx   )r%   
inline_run)r&   r7   ry   rI   s       r(   r{   zTestdir.inline_run   s#    (t~~((75E
 	
r*   c                :     | j                   j                  |i |S )z)See :meth:`Pytester.runpytest_inprocess`.)r%   runpytest_inprocessrX   s      r(   r}   zTestdir.runpytest_inprocess   s    1t~~114B6BBr*   c                :     | j                   j                  |i |S )zSee :meth:`Pytester.runpytest`.)r%   	runpytestrX   s      r(   r   zTestdir.runpytest   s    't~~''888r*   c                4     | j                   j                  | S )z!See :meth:`Pytester.parseconfig`.)r%   parseconfigrv   s     r(   r   zTestdir.parseconfig   s    )t~~))400r*   c                4     | j                   j                  | S )z$See :meth:`Pytester.parseconfigure`.)r%   parseconfigurerv   s     r(   r   zTestdir.parseconfigure   s    ,t~~,,d33r*   c                :    | j                   j                  ||      S )zSee :meth:`Pytester.getitem`.)r%   getitem)r&   rN   funcnames      r(   r   zTestdir.getitem   s    ~~%%fh77r*   c                8    | j                   j                  |      S )zSee :meth:`Pytester.getitems`.)r%   getitemsrM   s     r(   r   zTestdir.getitems   s    ~~&&v..r*   c                >    | j                   j                  |||      S )z"See :meth:`Pytester.getmodulecol`.)
configargswithinit)r%   getmodulecol)r&   rN   r   r   s       r(   r   zTestdir.getmodulecol   s%    ~~**zH + 
 	
r*   c                :    | j                   j                  ||      S )z%See :meth:`Pytester.collect_by_name`.)r%   collect_by_name)r&   modcolra   s      r(   r   zTestdir.collect_by_name   s    ~~--fd;;r*   c                B     | j                   j                  ||||fi |S )zSee :meth:`Pytester.popen`.)r%   popen)r&   cmdargsstdoutstderrstdinkws         r(   r   zTestdir.popen   s&     $t~~##GVVUIbIIr*   timeoutr   c               <     | j                   j                  |||dS )zSee :meth:`Pytester.run`.r   )r%   run)r&   r   r   r   s       r(   r   zTestdir.run   s    !t~~!!7G5IIr*   c                8    | j                   j                  |      S )zSee :meth:`Pytester.runpython`.)r%   	runpython)r&   scripts     r(   r   zTestdir.runpython   rS   r*   c                8    | j                   j                  |      S )z!See :meth:`Pytester.runpython_c`.)r%   runpython_c)r&   commands     r(   r   zTestdir.runpython_c   s    ~~))'22r*   )r   c               :     | j                   j                  |d|iS )z*See :meth:`Pytester.runpytest_subprocess`.r   )r%   runpytest_subprocess)r&   r   rI   s      r(   r   zTestdir.runpytest_subprocess   s    2t~~22DJ'JJr*   c                <    | j                   j                  ||      S )z"See :meth:`Pytester.spawn_pytest`.expect_timeout)r%   spawn_pytest)r&   stringr   s      r(   r   zTestdir.spawn_pytest   s    ~~**6.*QQr*   c                <    | j                   j                  ||      S )zSee :meth:`Pytester.spawn`.r   )r%   spawn)r&   cmdr   s      r(   r   zTestdir.spawn   s    ~~##C#GGr*   c                "    d| j                   dS )Nz	<Testdir >)r.   r-   s    r(   __repr__zTestdir.__repr__   s    4;;/++r*   c                ,    t        | j                        S r$   )strr.   r-   s    r(   __str__zTestdir.__str__   s    4;;r*   )r'   r   r"   boolreturnNoner   r
   )r   r   )r   r   )r   r   )rN   r   r   r   r$   )rh   r   r   Item | Collector | None)rn   zlist[Item | Collector]r   z
list[Item])ry   r   )r   r   )r   r   )	test_func)rw   F)r   r   ra   r   r   r   )g      $@)r   r   r   floatr   pexpect.spawn)r   r   r   r   r   r   )r   r   )9__name__
__module____qualname____doc____test__r   r   __annotations__r    r)   propertyr.   r1   r4   r7   setterr;   r=   r@   rC   rG   rL   rP   rR   rU   rW   rZ   r\   r_   rc   re   rg   rk   rm   rp   rr   ru   r{   r}   r   r   r   r   r   r   r   
subprocessPIPEr   r   r   r   r   r   r   r   r   rw   r*   r(   r   r   )   s    H!--K-$33NE3@E " 0 0 9 9 ' ' & & ^^) ) + +@&*
J@;0EGH279>301.E5 )+U 
C9148/
< 	J %) J03 37 KRH, r*   r   c                  (    e Zd Zeedd              Zy)LegacyTestdirPluginc                    t        | d      S )z
        Identical to :fixture:`pytester`, and provides an instance whose methods return
        legacy ``LEGACY_PATH`` objects instead when applicable.

        New code should avoid using :fixture:`testdir` in favor of :fixture:`pytester`.
        Tr!   )r   )r'   s    r(   testdirzLegacyTestdirPlugin.testdir   s     x400r*   N)r'   r   r   r   )r   r   r   staticmethodr   r   rw   r*   r(   r   r      s    1  1r*   r   c                  F    e Zd ZU dZded<   dd	 	 	 	 	 d
dZdddZddZy	)TempdirFactorya  Backward compatibility wrapper that implements ``py.path.local``
    for :class:`TempPathFactory`.

    .. note::
        These days, it is preferred to use ``tmp_path_factory``.

        :ref:`About the tmpdir and tmpdir_factory fixtures<tmpdir and tmpdir_factory>`.

    r   _tmppath_factoryFr!   c               (    t        |       || _        y r$   )r   r   )r&   tmppath_factoryr"   s      r(   r)   zTempdirFactory.__init__  s     	y! /r*   c                h    t        | j                  j                  ||      j                               S )zOSame as :meth:`TempPathFactory.mktemp`, but returns a ``py.path.local`` object.)r   r   mktempresolve)r&   basenamenumbereds      r(   r   zTempdirFactory.mktemp  s)    40077(KSSUVVr*   c                d    t        | j                  j                         j                               S )zTSame as :meth:`TempPathFactory.getbasetemp`, but returns a ``py.path.local`` object.)r   r   getbasetempr   r-   s    r(   r   zTempdirFactory.getbasetemp#  s%    400<<>FFHIIr*   N)r   r   r"   r   r   r   )T)r   r   r   r   r   r
   r   )r   r   r   r   r   r)   r   r   rw   r*   r(   r   r   
  s?     &% FK0.0>B0	0WJr*   r   c                  R    e Zd Ze ed      dd              Zeedd              Zy)LegacyTmpdirPluginsession)scopec                .    | j                   j                  S )zFReturn a :class:`pytest.TempdirFactory` instance for the test session.)rh   _tmpdirhandler)r4   s    r(   tmpdir_factoryz!LegacyTmpdirPlugin.tmpdir_factory)  s    
 ~~,,,r*   c                    t        |       S )a=  Return a temporary directory (as `legacy_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`.

        .. note::
            These days, it is preferred to use ``tmp_path``.

            :ref:`About the tmpdir and tmpdir_factory fixtures<tmpdir and tmpdir_factory>`.

        .. _legacy_path: https://py.readthedocs.io/en/latest/path.html
        r   )tmp_paths    r(   r.   zLegacyTmpdirPlugin.tmpdir0  s      8$$r*   N)r4   r   r   r   )r   r   r   r
   )r   r   r   r   r   r   r.   rw   r*   r(   r   r   (  s=    9-  -
 %  %r*   r   c                6    t        | j                  |            S )z{Return a directory path object with the given name.

    Same as :func:`mkdir`, but returns a legacy py path instance.
    )r   r_   r`   s     r(   Cache_makedirr   C  s    
 tzz$'((r*   c                ,    t        | j                        S )zO(deprecated) The file system path of the test module which collected this test.r   r,   r-   s    r(   FixtureRequest_fspathr   K      tyy!!r*   c                ,    t        | j                        S )zThe directory from which pytest was invoked.

    Prefer to use ``startpath`` which is a :class:`pathlib.Path`.

    :type: LEGACY_PATH
    r   	startpathr-   s    r(   TerminalReporter_startdirr   P       t~~&&r*   c                R    t        t        | j                  j                              S )zThe directory from which pytest was invoked.

    Prefer to use :attr:`invocation_params.dir <InvocationParams.dir>`,
    which is a :class:`pathlib.Path`.

    :type: LEGACY_PATH
    )r   r   invocation_paramsdirr-   s    r(   Config_invocation_dirr   Z  s      s41155677r*   c                >    t        t        | j                              S )zThe path to the :ref:`rootdir <rootdir>`.

    Prefer to use :attr:`rootpath`, which is a :class:`pathlib.Path`.

    :type: LEGACY_PATH
    )r   r   rootpathr-   s    r(   Config_rootdirr   e  s     s4==)**r*   c                Z    | j                   rt        t        | j                               S dS )zThe path to the :ref:`configfile <configfiles>`.

    Prefer to use :attr:`inipath`, which is a :class:`pathlib.Path`.

    :type: Optional[LEGACY_PATH]
    N)inipathr   r   r-   s    r(   Config_inifiler   o  s#     .2\\;s4<<()CtCr*   c                ,    t        | j                        S )zThe path from which pytest was invoked.

    Prefer to use ``startpath`` which is a :class:`pathlib.Path`.

    :type: LEGACY_PATH
    r   r-   s    r(   Session_startdirr   y  r   r*   c           	        |dk(  rp| j                   J | j                   j                  }t        |t              rt	        j
                  |      n|}|D cg c]  }t        t        ||z               c}S t        d| |      c c}w )Npathlistzunknown configuration type: )r   parent
isinstancer   shlexsplitr   
ValueError)r&   ra   typevaluedpinput_valuesxs          r(   Config__getini_unknown_typer     s    z||'''\\  -7s-Cu{{5)2>?,QCQK(,??7v>FF @s   Bc                ,    t        | j                        S )z4(deprecated) returns a legacy_path copy of self.pathr   r-   s    r(   Node_fspathr    r   r*   c                $    t        |      | _        y r$   )r   r,   )r&   r   s     r(   Node_fspath_setr    s    UDIr*   T)tryfirstc                   t               }| j                  |j                         |j                  t        dt
        d       |j                  t        dt        t              d       |j                  t        dt        t              d       |j                  t        dt        t              d       |j                  t        dt        t              d       |j                  t        dt        t              d       |j                  t        dt        t               d       |j                  t        d	t"               |j                  t$        dt        t&        t(              d       y
)zLMonkeypatch legacy path attributes in several classes, as early as possible.makedirFraisingfspathstartdirinvocation_dirrootdirinifile_getini_unknown_typeN)r   add_cleanupundosetattrr	   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  )early_configmps     r(   pytest_load_initial_conftestsr    s    
BRWW% JJuiJ> JJ~x2G)HRWJX JJ*h/H&ISX  
 JJv'2G)HRWJXJJvy(>":EJJJJvy(>":EJJ JJw
H-=$>JN JJv-/JK JJtXx_EuJUr*   c                B   | j                   j                  d      rut               }| j                  |j                         	 | j
                  }t        |d      }|j                  | d|d       | j                   j                  t        d       yy# t        $ r Y -w xY w)	zKInstalls the LegacyTmpdirPlugin if the ``tmpdir`` plugin is also installed.r.   Tr!   r   Fr  zlegacypath-tmpdirN)r>   
has_pluginr   r  r  _tmp_path_factoryr   r  AttributeErrorregisterr   )rh   r  tmp_path_factoryr   s       r(   pytest_configurer    s     &&x0]277#	P%77
 ,,<MNJJv/JO%%&8:MN# 1  		s   B 	BBc                    | |j                  d      u }|r-|j                  t              s|j                  t        d       y y y )Nr'   zlegacypath-pytester)
get_pluginis_registeredr   r  )pluginmanageris_pytesters      r(   pytest_plugin_registeredr#    sD     G..z::K7001DE,.CD F{r*   )r&   r	   ra   r   r   r
   )r&   r   r   r
   )r&   r   r   r
   )r&   r   r   r
   )r&   r   r   zLEGACY_PATH | None)r&   r   r   r
   )ra   r   r   r   r   zstr | list[str])r&   r   r   r
   )r&   r   r   r
   r   r   )r  r   r   r   )rh   r   r   r   )r   objectr!  r   r   r   )?r   
__future__r   dataclassespathlibr   r   r   typingr   r   r   	iniconfigr   _pytest.cacheproviderr	   _pytest.compatr
   r   _pytest.configr   r   r   _pytest.deprecatedr   _pytest.fixturesr   r   _pytest.mainr   _pytest.monkeypatchr   _pytest.nodesr   r   r   _pytest.pytesterr   r   r   _pytest.terminalr   _pytest.tmpdirr   pexpectr   r   	dataclassr   r   r   r   r   r   r   r   r   r   r  r  r  r  r#  rw   r*   r(   <module>r7     s:   E "         $ ' & & ! # . - $ +   + #   ) % & - *  P  P  P f
1 
1 J J  J8% %6)"
'8+D'G"
 
4V V> 
O 
O, 
E 
Er*   