
    F-Ph@                       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#          Z1dId*Z2dJd,Z3dKd.Z4dLd0Z5dLd1Z6dMd3Z7dNd5Z8dOd9Z9dPd;Z:dQd=Z; ed>?          dRdA            Z<edSdC            Z=edTdH            Z>dS )Uz?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                  F   e Zd ZU dZdZej        Zded<   ej        Zded<   dddWdZ	e
dXd            Ze
dXd            Ze
d             Ze
d             Zej        d             Ze
dYd            ZdZdZd[dZd[dZdXdZdXdZdXdZd\d ZdXd!ZdXd"ZdXd#Zd]d[d%ZdXd&ZdXd'Zd]dXd(Zd^d,Zd- Z d_d1Z!d2 Z"d3 Z#d4 Z$d5dd6d`d8Z%dad:Z&dad;Z'dbd<Z(dbd=Z)dcd?Z*d@ Z+dddAZ,dedEZ-e.j/        e.j/        efdFZ0d$edGdadHZ1dadIZ2dJ Z3d$dKdadLZ4dfdgdRZ5dfdhdTZ6didUZ7didVZ8d$S )j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	_ispytestpytesterr   r"   boolreturnNonec               2    t          |           || _        d S N)r   	_pytester)selfr#   r"   s      R/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/_pytest/legacypath.py__init__zTestdir.__init__7   s    y!!!!    r
   c                4    t          | j        j                  S )z-Temporary directory where tests are executed.)r   r)   pathr*   s    r+   tmpdirzTestdir.tmpdir;   s     4>.///r-   c                4    t          | j        j                  S r(   )r   r)   _test_tmprootr0   s    r+   test_tmprootzTestdir.test_tmproot@   s    4>7888r-   c                    | j         j        S r(   )r)   _requestr0   s    r+   requestzTestdir.requestD   s    ~&&r-   c                    | j         j        S r(   r)   pluginsr0   s    r+   r:   zTestdir.pluginsH   s    ~%%r-   c                    || j         _        d S r(   r9   )r*   r:   s     r+   r:   zTestdir.pluginsL   s    !(r-   r   c                    | j         j        S r(   )r)   _monkeypatchr0   s    r+   monkeypatchzTestdir.monkeypatchP   s    ~**r-   r   c                6    | 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                4    | j                                         S )zSee :meth:`Pytester.chdir`.)r)   chdirr0   s    r+   rC   zTestdir.chdirX   s    ~##%%%r-   c                4    | j                                         S r(   )r)   	_finalizer0   s    r+   finalizezTestdir.finalize\   s    ~'')))r-   c                    |r|                     d          sd|z   }t           | j        j        |g|R i |          S )zSee :meth:`Pytester.makefile`..)
startswithr   r)   makefile)r*   extargskwargss       r+   rJ   zTestdir.makefile_   sV     	s~~c** 	 )C24>23HHHHHHIIIr-   c                P    t          | j                            |                    S )z"See :meth:`Pytester.makeconftest`.)r   r)   makeconftestr*   sources     r+   rO   zTestdir.makeconftestk   s     4>66v>>???r-   c                P    t          | j                            |                    S )zSee :meth:`Pytester.makeini`.)r   r)   makeinirP   s     r+   rS   zTestdir.makeinio   s     4>11&99:::r-   rQ   strr   c                6    | j                             |          S )zSee :meth:`Pytester.getinicfg`.)r)   	getinicfgrP   s     r+   rV   zTestdir.getinicfgs       ~''///r-   c                P    t          | j                            |                    S )z'See :meth:`Pytester.makepyprojecttoml`.)r   r)   makepyprojecttomlrP   s     r+   rY   zTestdir.makepyprojecttomlw   s     4>;;FCCDDDr-   c                @    t           | j        j        |i |          S )z See :meth:`Pytester.makepyfile`.)r   r)   
makepyfiler*   rL   rM   s      r+   r[   zTestdir.makepyfile{   s%    44>4dEfEEFFFr-   c                @    t           | j        j        |i |          S )z!See :meth:`Pytester.maketxtfile`.)r   r)   maketxtfiler\   s      r+   r^   zTestdir.maketxtfile   s%    54>5tFvFFGGGr-   Nc                6    | j                             |          S )z#See :meth:`Pytester.syspathinsert`.)r)   syspathinsertr*   r/   s     r+   r`   zTestdir.syspathinsert   s    ~++D111r-   c                P    t          | j                            |                    S )zSee :meth:`Pytester.mkdir`.)r   r)   mkdirr*   names     r+   rc   zTestdir.mkdir   s     4>//55666r-   c                P    t          | j                            |                    S )zSee :meth:`Pytester.mkpydir`.)r   r)   mkpydirrd   s     r+   rg   zTestdir.mkpydir   s     4>11$77888r-   c                P    t          | j                            |                    S )z"See :meth:`Pytester.copy_example`.)r   r)   copy_examplerd   s     r+   ri   zTestdir.copy_example   s     4>66t<<===r-   configr   Item | Collector | Nonec                8    | j                             ||          S )zSee :meth:`Pytester.getnode`.)r)   getnode)r*   rj   args      r+   rm   zTestdir.getnode   s    ~%%fc222r-   c                6    | j                             |          S )z!See :meth:`Pytester.getpathnode`.)r)   getpathnodera   s     r+   rp   zTestdir.getpathnode   s    ~))$///r-   colitemslist[Item | Collector]
list[Item]c                6    | j                             |          S )zSee :meth:`Pytester.genitems`.)r)   genitems)r*   rq   s     r+   ru   zTestdir.genitems   s    ~&&x000r-   c                6    | j                             |          S )zSee :meth:`Pytester.runitem`.)r)   runitemrP   s     r+   rw   zTestdir.runitem   s    ~%%f---r-   c                (     | j         j        |g|R  S )z&See :meth:`Pytester.inline_runsource`.)r)   inline_runsource)r*   rQ   cmdlineargss      r+   ry   zTestdir.inline_runsource   s    .t~.vDDDDDr-   c                      | j         j        | S )z%See :meth:`Pytester.inline_genitems`.)r)   inline_genitemsr*   rL   s     r+   r|   zTestdir.inline_genitems   s    -t~-t44r-    r:   no_reraise_ctrlcr   c               (     | j         j        |||dS )z See :meth:`Pytester.inline_run`.r   )r)   
inline_run)r*   r:   r   rL   s       r+   r   zTestdir.inline_run   s(    (t~(75E
 
 
 	
r-   r   c                &     | j         j        |i |S )z)See :meth:`Pytester.runpytest_inprocess`.)r)   runpytest_inprocessr\   s      r+   r   zTestdir.runpytest_inprocess   s    1t~14B6BBBr-   c                &     | j         j        |i |S )zSee :meth:`Pytester.runpytest`.)r)   	runpytestr\   s      r+   r   zTestdir.runpytest   s    't~'8888r-   c                      | j         j        | S )z!See :meth:`Pytester.parseconfig`.)r)   parseconfigr}   s     r+   r   zTestdir.parseconfig   s    )t~)400r-   c                      | j         j        | S )z$See :meth:`Pytester.parseconfigure`.)r)   parseconfigurer}   s     r+   r   zTestdir.parseconfigure   s    ,t~,d33r-   	test_funcc                8    | j                             ||          S )zSee :meth:`Pytester.getitem`.)r)   getitem)r*   rQ   funcnames      r+   r   zTestdir.getitem   s    ~%%fh777r-   c                6    | j                             |          S )zSee :meth:`Pytester.getitems`.)r)   getitemsrP   s     r+   r   zTestdir.getitems   s    ~&&v...r-   c                <    | j                             |||          S )z"See :meth:`Pytester.getmodulecol`.)
configargswithinit)r)   getmodulecol)r*   rQ   r   r   s       r+   r   zTestdir.getmodulecol   s(    ~**zH + 
 
 	
r-   modcolr   re   c                8    | j                             ||          S )z%See :meth:`Pytester.collect_by_name`.)r)   collect_by_name)r*   r   re   s      r+   r   zTestdir.collect_by_name   s    ~--fd;;;r-   c                .     | 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IIbI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IIIr-   c                6    | j                             |          S )zSee :meth:`Pytester.runpython`.)r)   	runpython)r*   scripts     r+   r   zTestdir.runpython   rW   r-   c                6    | j                             |          S )z!See :meth:`Pytester.runpython_c`.)r)   runpython_c)r*   commands     r+   r   zTestdir.runpython_c   s    ~))'222r-   )r   c               &     | j         j        |d|iS )z*See :meth:`Pytester.runpytest_subprocess`.r   )r)   runpytest_subprocess)r*   r   rL   s      r+   r   zTestdir.runpytest_subprocess   s    2t~2DJ'JJJr-         $@stringexpect_timeoutfloatpexpect.spawnc                :    | j                             ||          S )z"See :meth:`Pytester.spawn_pytest`.r   )r)   spawn_pytest)r*   r   r   s      r+   r   zTestdir.spawn_pytest   s    ~**6.*QQQr-   cmdc                :    | j                             ||          S )zSee :meth:`Pytester.spawn`.r   )r)   spawn)r*   r   r   s      r+   r   zTestdir.spawn   s    ~##C#GGGr-   c                    d| j         dS )Nz	<Testdir >)r1   r0   s    r+   __repr__zTestdir.__repr__   s    +4;++++r-   c                *    t          | j                  S r(   )rT   r1   r0   s    r+   __str__zTestdir.__str__   s    4;r-   )r#   r   r"   r$   r%   r&   r%   r
   )r%   r   )r%   r   )r%   r&   )rQ   rT   r%   r   r(   )rj   r   r%   rk   )rq   rr   r%   rs   )r   r$   )r%   r   )r%   r   )r   )r~   F)r   r   re   rT   r%   rk   )r   )r   rT   r   r   r%   r   )r   rT   r   r   r%   r   )r%   rT   )9__name__
__module____qualname____doc____test__r   r   __annotations__r    r,   propertyr1   r4   r7   r:   setterr>   r@   rC   rF   rJ   rO   rS   rV   rY   r[   r^   r`   rc   rg   ri   rm   rp   ru   rw   ry   r|   r   r   r   r   r   r   r   r   r   
subprocessPIPEr   r   r   r   r   r   r   r   r   r~   r-   r+   r   r   )   s          H!-K----$3N3333@E " " " " " " 0 0 0 X0 9 9 9 X9 ' ' X' & & X& ^) ) ^) + + + X+@ @ @ @& & & &* * * *
J 
J 
J 
J@ @ @ @; ; ; ;0 0 0 0E E E EG G G GH H H H2 2 2 2 27 7 7 79 9 9 9> > > > >3 3 3 30 0 01 1 1 1. . .E E E5 5 5 )+U 
 
 
 
 
 
C C C C9 9 9 91 1 1 14 4 4 48 8 8 8/ / /
 
 
 
< < < < 	J 	J 	J 	J %) J J J J J J0 0 0 03 3 3 37 K K K K K KR R R R RH H H H H, , , ,           r-   r   c                  6    e Zd Zeedd                        ZdS )LegacyTestdirPluginr#   r   r%   r   c                $    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000r-   N)r#   r   r%   r   )r   r   r   staticmethodr   r   r~   r-   r+   r   r      s<        1 1 1 W \1 1 1r-   r   c                  >    e Zd ZU dZded<   ddddZdddZddZdS )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!   tmppath_factoryr"   r$   r%   r&   c               2    t          |           || _        d S r(   )r   r   )r*   r   r"   s      r+   r,   zTempdirFactory.__init__  s      	y!!! /r-   TbasenamerT   numberedr
   c                v    t          | j                            ||                                                    S )zOSame as :meth:`TempPathFactory.mktemp`, but returns a ``py.path.local`` object.)r   r   mktempresolve)r*   r   r   s      r+   r   zTempdirFactory.mktemp  s/    4077(KKSSUUVVVr-   c                r    t          | j                                                                                  S )zTSame as :meth:`TempPathFactory.getbasetemp`, but returns a ``py.path.local`` object.)r   r   getbasetempr   r0   s    r+   r   zTempdirFactory.getbasetemp#  s+    40<<>>FFHHIIIr-   N)r   r   r"   r$   r%   r&   )T)r   rT   r   r$   r%   r
   r   )r   r   r   r   r   r,   r   r   r~   r-   r+   r   r   
  s           &%%% FK0 0 0 0 0 0W W W W WJ J J J J Jr-   r   c                  r    e Zd Ze ed          dd                        Zeedd                        ZdS )LegacyTmpdirPluginsession)scoper7   r   r%   r   c                    | j         j        S )zFReturn a :class:`pytest.TempdirFactory` instance for the test session.)rj   _tmpdirhandler)r7   s    r+   tmpdir_factoryz!LegacyTmpdirPlugin.tmpdir_factory)  s    
 ~,,r-   tmp_pathr   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   )r   s    r+   r1   zLegacyTmpdirPlugin.tmpdir0  s      8$$$r-   N)r7   r   r%   r   )r   r   r%   r
   )r   r   r   r   r   r   r1   r~   r-   r+   r   r   (  st        W9- - -  \-
 % % % W \% % %r-   r   r*   r	   re   rT   r%   r
   c                F    t          |                     |                    S )z{Return a directory path object with the given name.

    Same as :func:`mkdir`, but returns a legacy py path instance.
    )r   rc   rd   s     r+   Cache_makedirr   C  s    
 tzz$''(((r-   r   c                *    t          | j                  S )zO(deprecated) The file system path of the test module which collected this test.r   r/   r0   s    r+   FixtureRequest_fspathr   K      ty!!!r-   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   	startpathr0   s    r+   TerminalReporter_startdirr   P       t~&&&r-   r   c                N    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   rT   invocation_paramsdirr0   s    r+   Config_invocation_dirr   Z  s      s41566777r-   c                D    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   rT   rootpathr0   s    r+   Config_rootdirr   e  s     s4=))***r-   LEGACY_PATH | Nonec                V    | j         r!t          t          | j                             n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   rT   r0   s    r+   Config_inifiler   o  s(     .2\C;s4<(()))tCr-   r   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   r0   s    r+   Session_startdirr   y  r   r-   typevaluestr | list[str]c                    |dk    rN| j         J | j         j        t          |t                    rt	          j        |          n|}fd|D             S t          d| |          )Npathlistc                N    g | ]!}t          t          |z                      "S r~   )r   rT   ).0xdps     r+   
<listcomp>z/Config__getini_unknown_type.<locals>.<listcomp>  s+    ???QCQKK((???r-   zunknown configuration type: )r   parent
isinstancerT   shlexsplit
ValueError)r*   re   r   r   input_valuesr   s        @r+   Config__getini_unknown_typer    s|    z|'''\ -7s-C-CNu{5)))????,????>>>FFFr-   r   c                *    t          | j                  S )z4(deprecated) returns a legacy_path copy of self.pathr   r0   s    r+   Node_fspathr
    r   r-   r&   c                .    t          |          | _        d S r(   )r   r/   )r*   r   s     r+   Node_fspath_setr    s    UDIIIr-   T)tryfirstearly_configc                   t                      }|                     |j                   |                    t          dt
          d           |                    t          dt          t                    d           |                    t          dt          t                    d           |                    t          dt          t                    d           |                    t          dt          t                    d           |                    t          dt          t                    d           |                    t          dt          t                     d           |                    t          d	t"                     |                    t$          dt          t&          t(                    d           d
S )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  )r  mps     r+   pytest_load_initial_conftestsr    sk    
BRW%%% JJuiJ>>> JJ~x2G)H)HRWJXXX JJ*h/H&I&ISX    
 JJv'2G)H)HRWJXXXJJvy(>":":EJJJJJJvy(>":":EJJJJ JJw
H-=$>$>JNNN JJv-/JKKK JJtXx_EEuJUUUUUr-   rj   c                T   | j                             d          rt                      }|                     |j                   	 | j        }t          |d          }|                    | d|d           n# t          $ r Y nw xY w| j         	                    t          d           dS dS )	zKInstalls the LegacyTmpdirPlugin if the ``tmpdir`` plugin is also installed.r1   Tr!   r   Fr  zlegacypath-tmpdirN)rA   
has_pluginr   r  r  _tmp_path_factoryr   r  AttributeErrorregisterr   )rj   r  tmp_path_factoryr   s       r+   pytest_configurer$    s     &&x00 O]]27###	P%7
 ,,<MMMNJJv/JOOOO  	 	 	D	 	%%&8:MNNNNN#O Os   A6 6
BBpluginobjectmanagerr   c                    | |                     d          u }|r7|                    t                    s|                    t          d           d S d S d S )Nr#   zlegacypath-pytester)
get_pluginis_registeredr   r"  )r%  r'  is_pytesters      r+   pytest_plugin_registeredr,    sr     G..z:::K E7001DEE E,.CDDDDDE E E Er-   )r*   r	   re   rT   r%   r
   )r*   r   r%   r
   )r*   r   r%   r
   )r*   r   r%   r
   )r*   r   r%   r   )r*   r   r%   r
   )re   rT   r   rT   r   r   )r*   r   r%   r
   )r*   r   r   r
   r%   r&   )r  r   r%   r&   )rj   r   r%   r&   )r%  r&  r'  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,  r~   r-   r+   <module>r?     s.   E E " " " " " "                                        $ $ $ $ $ $ ' ' ' ' ' ' & & & & & & & & & & & & ! ! ! ! ! ! # # # # # # . . . . . . - - - - - - $ $ $ $ $ $ + + + + + +             + + + + + + # # # # # #             ) ) ) ) ) ) % % % % % % & & & & & & - - - - - - * * * * * *  NNN P  P  P  P  P  P  P  P f
1 
1 
1 
1 
1 
1 
1 
1 J J J J J J J  J8% % % % % % % %6) ) ) )" " " "
' ' ' '8 8 8 8+ + + +D D D D' ' ' 'G G G G" " " "
    
4V V V V> 
O O O 
O, 
E E E 
E E Er-   