
    ?g@                       S r SSKJr  SSKrSSKJr  SSKrSSKrSSKJ	r	  SSKJ
r
  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK J!r!  SSK J"r"  SSK J#r#  SSK$J%r%  SSK$J&r&  SSK$J'r'  SSK(J)r)  SSK*J+r+  \(       a  SSK,r,\
 " S S5      5       r- " S S5      r.\
\R^                   " S  S!5      5       5       r0 " S" S#5      r1S3S$ jr2S4S% jr3S5S& jr4S6S' jr5S6S( jr6S7S) jr7S8S* jr8S9S+ jr9S:S, jr:S;S- jr;\" S.S/9S<S0 j5       r<\S=S1 j5       r=\S>S2 j5       r>g)?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S rSr% SrSr\R                  rS\S'   \R                  r	S\S'   SS.S;S jjr
\S<S	 j5       r\S<S
 j5       r\S 5       r\S 5       r\R                   S 5       r\S=S j5       rS>S jrS?S jrS?S jrS<S jrS<S jrS<S jrS@S jrS<S jrS<S jrS<S jrSAS?S jjrS<S jrS<S jrSAS<S jjrSBS jr S r!SCS  jr"S! r#S" r$S# r%S$SS%.SDS& jjr&SES' jr'SES( jr(SFS) jr)SFS* jr*SGS+ jr+S, r,SHS- jr-SIS. jr.\/R`                  \/R`                  \4S/ jr1S\S0.SES1 jjr2SES2 jr3S3 r4SS4.SES5 jjr5SJSKS6 jjr6SJSLS7 jjr7SMS8 jr8SMS9 jr9S:r:g)NTestdir)   z
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               &    [        U5        Xl        g N)r   	_pytester)selfpytesterr#   s      4/usr/lib/python3/dist-packages/_pytest/legacypath.py__init__Testdir.__init__7   s    y!!    c                @    [        U R                  R                  5      $ )z-Temporary directory where tests are executed.)r   r&   pathr'   s    r)   tmpdirTestdir.tmpdir;   s     4>>..//r,   c                @    [        U R                  R                  5      $ r%   )r   r&   _test_tmprootr/   s    r)   test_tmprootTestdir.test_tmproot@   s    4>>7788r,   c                .    U R                   R                  $ r%   )r&   _requestr/   s    r)   requestTestdir.requestD   s    ~~&&&r,   c                .    U R                   R                  $ r%   r&   pluginsr/   s    r)   r<   Testdir.pluginsH   s    ~~%%%r,   c                $    XR                   l        g r%   r;   )r'   r<   s     r)   r<   r=   L   s    !(r,   c                .    U R                   R                  $ r%   )r&   _monkeypatchr/   s    r)   monkeypatchTestdir.monkeypatchP   s    ~~***r,   c                8    U R                   R                  U5      $ )z(See :meth:`Pytester.make_hook_recorder`.)r&   make_hook_recorder)r'   pluginmanagers     r)   rD   Testdir.make_hook_recorderT   s    ~~00??r,   c                6    U R                   R                  5       $ )zSee :meth:`Pytester.chdir`.)r&   chdirr/   s    r)   rH   Testdir.chdirX   s    ~~##%%r,   c                6    U R                   R                  5       $ r%   )r&   	_finalizer/   s    r)   finalizeTestdir.finalize\   s    ~~''))r,   c                    U(       a  UR                  S5      (       d  SU-   n[        U R                  R                  " U/UQ70 UD65      $ )zSee :meth:`Pytester.makefile`..)
startswithr   r&   makefile)r'   extargskwargss       r)   rQ   Testdir.makefile_   sB    s~~c** )C4>>223HHHIIr,   c                J    [        U R                  R                  U5      5      $ )z"See :meth:`Pytester.makeconftest`.)r   r&   makeconftestr'   sources     r)   rW   Testdir.makeconftestk   s    4>>66v>??r,   c                J    [        U R                  R                  U5      5      $ )zSee :meth:`Pytester.makeini`.)r   r&   makeinirX   s     r)   r\   Testdir.makeinio   s    4>>11&9::r,   c                8    U R                   R                  U5      $ )zSee :meth:`Pytester.getinicfg`.)r&   	getinicfgrX   s     r)   r_   Testdir.getinicfgs       ~~''//r,   c                J    [        U R                  R                  U5      5      $ )z'See :meth:`Pytester.makepyprojecttoml`.)r   r&   makepyprojecttomlrX   s     r)   rc   Testdir.makepyprojecttomlw   s    4>>;;FCDDr,   c                L    [        U R                  R                  " U0 UD65      $ )z See :meth:`Pytester.makepyfile`.)r   r&   
makepyfiler'   rS   rT   s      r)   rf   Testdir.makepyfile{   s!    4>>44dEfEFFr,   c                L    [        U R                  R                  " U0 UD65      $ )z!See :meth:`Pytester.maketxtfile`.)r   r&   maketxtfilerg   s      r)   rj   Testdir.maketxtfile   s!    4>>55tFvFGGr,   Nc                8    U R                   R                  U5      $ )z#See :meth:`Pytester.syspathinsert`.)r&   syspathinsertr'   r.   s     r)   rm   Testdir.syspathinsert   s    ~~++D11r,   c                J    [        U R                  R                  U5      5      $ )zSee :meth:`Pytester.mkdir`.)r   r&   mkdirr'   names     r)   rq   Testdir.mkdir   s    4>>//566r,   c                J    [        U R                  R                  U5      5      $ )zSee :meth:`Pytester.mkpydir`.)r   r&   mkpydirrr   s     r)   rv   Testdir.mkpydir   s    4>>11$788r,   c                J    [        U R                  R                  U5      5      $ )z"See :meth:`Pytester.copy_example`.)r   r&   copy_examplerr   s     r)   ry   Testdir.copy_example   s    4>>66t<==r,   c                8    U R                   R                  X5      $ )zSee :meth:`Pytester.getnode`.)r&   getnode)r'   configargs      r)   r|   Testdir.getnode   s    ~~%%f22r,   c                8    U R                   R                  U5      $ )z!See :meth:`Pytester.getpathnode`.)r&   getpathnodern   s     r)   r   Testdir.getpathnode   s    ~~))$//r,   c                8    U R                   R                  U5      $ )zSee :meth:`Pytester.genitems`.)r&   genitems)r'   colitemss     r)   r   Testdir.genitems   s    ~~&&x00r,   c                8    U R                   R                  U5      $ )zSee :meth:`Pytester.runitem`.)r&   runitemrX   s     r)   r   Testdir.runitem   s    ~~%%f--r,   c                <    U R                   R                  " U/UQ76 $ )z&See :meth:`Pytester.inline_runsource`.)r&   inline_runsource)r'   rY   cmdlineargss      r)   r   Testdir.inline_runsource   s    ~~..vDDDr,   c                4    U R                   R                  " U6 $ )z%See :meth:`Pytester.inline_genitems`.)r&   inline_genitemsr'   rS   s     r)   r   Testdir.inline_genitems   s    ~~--t44r,    r<   no_reraise_ctrlcc               :    U R                   R                  " X1US.6$ )z See :meth:`Pytester.inline_run`.r   )r&   
inline_run)r'   r<   r   rS   s       r)   r   Testdir.inline_run   s    ~~((5E
 	
r,   c                :    U R                   R                  " U0 UD6$ )z)See :meth:`Pytester.runpytest_inprocess`.)r&   runpytest_inprocessrg   s      r)   r   Testdir.runpytest_inprocess   s    ~~114B6BBr,   c                :    U R                   R                  " U0 UD6$ )zSee :meth:`Pytester.runpytest`.)r&   	runpytestrg   s      r)   r   Testdir.runpytest   s    ~~''888r,   c                4    U R                   R                  " U6 $ )z!See :meth:`Pytester.parseconfig`.)r&   parseconfigr   s     r)   r   Testdir.parseconfig   s    ~~))400r,   c                4    U R                   R                  " U6 $ )z$See :meth:`Pytester.parseconfigure`.)r&   parseconfigurer   s     r)   r   Testdir.parseconfigure   s    ~~,,d33r,   c                8    U R                   R                  X5      $ )zSee :meth:`Pytester.getitem`.)r&   getitem)r'   rY   funcnames      r)   r   Testdir.getitem   s    ~~%%f77r,   c                8    U R                   R                  U5      $ )zSee :meth:`Pytester.getitems`.)r&   getitemsrX   s     r)   r   Testdir.getitems   s    ~~&&v..r,   c                6    U R                   R                  XUS9$ )z"See :meth:`Pytester.getmodulecol`.)
configargswithinit)r&   getmodulecol)r'   rY   r   r   s       r)   r   Testdir.getmodulecol   s#    ~~**H + 
 	
r,   c                8    U R                   R                  X5      $ )z%See :meth:`Pytester.collect_by_name`.)r&   collect_by_name)r'   modcolrs   s      r)   r   Testdir.collect_by_name   s    ~~--f;;r,   c                >    U R                   R                  " XX440 UD6$ )zSee :meth:`Pytester.popen`.)r&   popen)r'   cmdargsstdoutstderrstdinkws         r)   r   Testdir.popen   s      ~~##GVIbIIr,   timeoutr   c               :    U R                   R                  " X1US.6$ )zSee :meth:`Pytester.run`.r   )r&   run)r'   r   r   r   s       r)   r   Testdir.run   s    ~~!!75IIr,   c                8    U R                   R                  U5      $ )zSee :meth:`Pytester.runpython`.)r&   	runpython)r'   scripts     r)   r   Testdir.runpython   ra   r,   c                8    U R                   R                  U5      $ )z!See :meth:`Pytester.runpython_c`.)r&   runpython_c)r'   commands     r)   r   Testdir.runpython_c   s    ~~))'22r,   )r   c               :    U R                   R                  " USU06$ )z*See :meth:`Pytester.runpytest_subprocess`.r   )r&   runpytest_subprocess)r'   r   rS   s      r)   r   Testdir.runpytest_subprocess   s    ~~22DJ'JJr,   c                4    U R                   R                  XS9$ )z"See :meth:`Pytester.spawn_pytest`.expect_timeout)r&   spawn_pytest)r'   stringr   s      r)   r   Testdir.spawn_pytest   s    ~~**6*QQr,   c                4    U R                   R                  XS9$ )zSee :meth:`Pytester.spawn`.r   )r&   spawn)r'   cmdr   s      r)   r   Testdir.spawn   s    ~~##C#GGr,   c                $    SU R                   < S3$ )Nz	<Testdir >)r0   r/   s    r)   __repr__Testdir.__repr__   s    4;;/++r,   c                ,    [        U R                  5      $ r%   )strr0   r/   s    r)   __str__Testdir.__str__   s    4;;r,   )r&   )r(   r   r#   boolreturnNoner   r
   )r   r   )r   r   )r   r   )rY   r   r   r   r%   )r}   r   r   Item | Collector | None)r   zlist[Item | Collector]r   z
list[Item])r   r   )r   r   )r   r   )	test_func)r   F)r   r   rs   r   r   r   )g      $@)r   r   r   floatr   pexpect.spawn)r   r   r   r   r   r   )r   r   );__name__
__module____qualname____firstlineno____doc____test__r   r    __annotations__r!   r*   propertyr0   r4   r8   r<   setterrA   rD   rH   rL   rQ   rW   r\   r_   rc   rf   rj   rm   rq   rv   ry   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   
subprocessPIPEr   r   r   r   r   r   r   r   r   __static_attributes__r   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                  2    \ rS rSr\\SS j5       5       rSrg)LegacyTestdirPlugin   c                    [        U SS9$ )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)   testdirLegacyTestdirPlugin.testdir   s     x400r,   r   N)r(   r   r   r   )r   r   r   r   staticmethodr   r   r   r   r,   r)   r   r      s    1  1r,   r   c                  X    \ rS rSr% SrS\S'   SS.     SS jjrSSS jjrSS	 jrS
r	g)TempdirFactoryi
  zBackward 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               &    [        U5        Xl        g r%   )r   r   )r'   tmppath_factoryr#   s      r)   r*   TempdirFactory.__init__  s     	y! /r,   c                f    [        U R                  R                  X5      R                  5       5      $ )zOSame as :meth:`TempPathFactory.mktemp`, but returns a ``py.path.local`` object.)r   r   mktempresolve)r'   basenamenumbereds      r)   r   TempdirFactory.mktemp  s'    40077KSSUVVr,   c                d    [        U R                  R                  5       R                  5       5      $ )zTSame as :meth:`TempPathFactory.getbasetemp`, but returns a ``py.path.local`` object.)r   r   getbasetempr  r/   s    r)   r  TempdirFactory.getbasetemp#  s%    400<<>FFHIIr,   )r   N)r   r   r#   r   r   r   )T)r  r   r  r   r   r
   r   )
r   r   r   r   r   r   r*   r   r  r   r   r,   r)   r   r   
  s?     &% FK0.0>B0	0WJr,   r   c                  X    \ rS rSr\\" SS9SS j5       5       r\\S	S j5       5       rSrg)
LegacyTmpdirPlugini(  session)scopec                .    U R                   R                  $ )zFReturn a :class:`pytest.TempdirFactory` instance for the test session.)r}   _tmpdirhandler)r8   s    r)   tmpdir_factory!LegacyTmpdirPlugin.tmpdir_factory)  s    
 ~~,,,r,   c                    [        U 5      $ )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)   r0   LegacyTmpdirPlugin.tmpdir0  s      8$$r,   r   N)r8   r   r   r   )r  r   r   r
   )	r   r   r   r   r   r   r  r0   r   r   r,   r)   r	  r	  (  s=    9-  -
 %  %r,   r	  c                6    [        U R                  U5      5      $ )zsReturn a directory path object with the given name.

Same as :func:`mkdir`, but returns a legacy py path instance.
)r   rq   rr   s     r)   Cache_makedirr  C  s    
 tzz$'((r,   c                ,    [        U R                  5      $ )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                ,    [        U R                  5      $ )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    [        [        U R                  R                  5      5      $ )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                >    [        [        U R                  5      5      $ )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                d    U R                   (       a  [        [        U R                   5      5      $ 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                ,    [        U R                  5      $ )z{The 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           	     (   US:X  ay  U R                   c   eU R                   R                  n[        U[        5      (       a  [        R
                  " U5      OUnU Vs/ s H  n[        [        XF-  5      5      PM     sn$ [        SU 3U5      es  snf )Npathlistzunknown configuration type: )r&  parent
isinstancer   shlexsplitr   
ValueError)r'   rs   typevaluedpinput_valuesxs          r)   Config__getini_unknown_typer6    s    z||'''\\  -7s-C-Cu{{5)2>?,QCK(,??7v>FF @s    Bc                ,    [        U R                  5      $ )z4(deprecated) returns a legacy_path copy of self.pathr  r/   s    r)   Node_fspathr8    r  r,   c                $    [        U5      U l        g r%   )r   r.   )r'   r2  s     r)   Node_fspath_setr:    s    UDIr,   T)tryfirstc                   [        5       nU R                  UR                  5        UR                  [        S[
        SS9  UR                  [        S[        [        5      SS9  UR                  [        S[        [        5      SS9  UR                  [        S[        [        5      SS9  UR                  [        S[        [        5      SS9  UR                  [        S[        [        5      SS9  UR                  [        S[        [         5      SS9  UR                  [        S	["        5        UR                  [$        S[        [&        [(        5      SS9  g
)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)  r6  r   r8  r:  )early_configmps     r)   pytest_load_initial_conftestsrK    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   U R                   R                  S5      (       ao  [        5       nU R                  UR                  5         U R
                  n[        USS9nUR                  U SUSS9  U R                   R                  [        S5        gg! [         a     N.f = f)	zKInstalls the LegacyTmpdirPlugin if the ``tmpdir`` plugin is also installed.r0   Tr"   r  Fr>  zlegacypath-tmpdirN)rE   
has_pluginr   rF  rG  _tmp_path_factoryr   rH  AttributeErrorregisterr	  )r}   rJ  tmp_path_factoryr  s       r)   pytest_configurerR    s     &&x00]277#	P%77
 ,,<MNJJv/JO%%&8:MN# 1  		s   B 
BBc                    XR                  S5      L nU(       a2  UR                  [        5      (       d  UR                  [        S5        g g g )Nr(   zlegacypath-pytester)
get_pluginis_registeredr   rP  )pluginmanageris_pytesters      r)   pytest_plugin_registeredrY    sE     ..z::K7001DEE,.CD F{r,   )r'   r	   rs   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
   )rs   r   r1  r   r2  zstr | list[str])r'   r   r   r
   )r'   r   r2  r
   r   r   )rI  r   r   r   )r}   r   r   r   )rV  objectrW  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)  r6  r8  r:  rK  rR  rY  r   r,   r)   <module>rm     s:   E "         $ ' & & ! # . - $ +   + #   ) % & - *  P  P  P f
1 
1 J J  J8% %6)"
'8+D'G"
 
4V V> 
O 
O, 
E 
Er,   