bg!B `dZddlZddlZddlZddlmZddlmZddlmZddlm Z ddlm Z ddl m Z dd l mZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl m"Z"ddl m#Z#ddl$m%Z%ddl$m&Z&ddl$m'Z'ddl(m)Z)ddl*m+Z+e r ddl,m-Z-ddl.Z.eGddZ/Gd d!Z0eej1Gd"d#Z2Gd$d%Z3d&ed'e4d(efd)Z5d&ed(efd*Z6d&e)d(efd+Z7d&ed(efd,Z8d&ed(efd-Z9d&ed(eefd.Z:d&ed(efd/Z;d'e4d0e4d1e e4ee4ffd2Zed56d7ed(dfd8Z?ed9ed(dfd:Z@ed;eAdz?Add backward compatibility support for the legacy py path type.N)Path)List)Optional) TYPE_CHECKING)Union)SectionWrapper)Cache)final) LEGACY_PATH legacy_path)Config)hookimpl)PytestPluginManager)check_ispytest)fixture)FixtureRequest)Session) MonkeyPatch) Collector)Item)Node) HookRecorder)Pytester) RunResult)TerminalReporter)TempPathFactory)Finalc LeZdZUdZdZejZded<ejZded<dddede d d fd Z e d e fd Z e d e fd Ze dZe dZejdZe d efdZd efdZdHdZdHdZd e fdZd e fdZd e fdZded efdZd e fdZd e fdZd e fdZ dIdHdZ!d e fdZ"d e fdZ#dId e fd Z$d!e%d e&e'e(e)ffd"Z*d#Z+d$e,e'e(e)fd e,e(fd%Z-d&Z.d'Z/d(Z0d)dd*d+e fd,Z1d e2fd-Z3d e2fd.Z4d e%fd/Z5d e%fd0Z6dJd2Z7d3Z8dKd4Z9d5e)d6ed e&e'e(e)ffd7Z:e;j<e;j<efd8Z=d ed9d e2fd:Z>d e2fd;Z?d<Z@d d=d e2fd>ZA dLd@edAeBd dBfdCZCdLdDedAeBd dBfdEZDd efdFZEd efdGZFd S)MTestdirz 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_STDINTimeoutExpired _ispytestpytesterr$returnNc2t|||_dSN)r _pytester)selfr%r$s c/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/_pytest/legacypath.py__init__zTestdir.__init__6sy!!!!c4t|jjS)z-Temporary directory where tests are executed.)r r)pathr*s r+tmpdirzTestdir.tmpdir:s4>.///r-c4t|jjSr()r r) _test_tmprootr0s r+ test_tmprootzTestdir.test_tmproot?s4>7888r-c|jjSr()r)_requestr0s r+requestzTestdir.requestCs ~&&r-c|jjSr(r)pluginsr0s r+r:zTestdir.pluginsGs ~%%r-c||j_dSr(r9)r*r:s r+r:zTestdir.pluginsKs!(r-c|jjSr()r) _monkeypatchr0s r+ monkeypatchzTestdir.monkeypatchOs ~**r-c6|j|S)z(See :meth:`Pytester.make_hook_recorder`.)r)make_hook_recorder)r* pluginmanagers r+r@zTestdir.make_hook_recorderSs~00???r-c4|jS)zSee :meth:`Pytester.chdir`.)r)chdirr0s r+rCz Testdir.chdirWs~##%%%r-c4|jS)zSee :meth:`Pytester._finalize`.)r) _finalizer0s r+finalizezTestdir.finalize[s~'')))r-c|r|dsd|z}t|jj|g|Ri|S)zSee :meth:`Pytester.makefile`..) startswithr r)makefile)r*extargskwargss r+rJzTestdir.makefile_sV  s~~c** )C24>23HHHHHHIIIr-cPt|j|S)z"See :meth:`Pytester.makeconftest`.)r r) makeconftestr*sources r+rOzTestdir.makeconftestks 4>66v>>???r-cPt|j|S)zSee :meth:`Pytester.makeini`.)r r)makeinirPs r+rSzTestdir.makeinios 4>11&99:::r-rQc6|j|S)zSee :meth:`Pytester.getinicfg`.)r) getinicfgrPs r+rUzTestdir.getinicfgs~''///r-cPt|j|S)z'See :meth:`Pytester.makepyprojecttoml`.)r r)makepyprojecttomlrPs r+rXzTestdir.makepyprojecttomlws 4>;;FCCDDDr-c@t|jj|i|S)z See :meth:`Pytester.makepyfile`.)r r) makepyfiler*rLrMs r+rZzTestdir.makepyfile{s%44>4dEfEEFFFr-c@t|jj|i|S)z!See :meth:`Pytester.maketxtfile`.)r r) maketxtfiler[s r+r]zTestdir.maketxtfiles%54>5tFvFFGGGr-c6|j|S)z#See :meth:`Pytester.syspathinsert`.)r) syspathinsertr*r/s r+r_zTestdir.syspathinserts~++D111r-cPt|j|S)zSee :meth:`Pytester.mkdir`.)r r)mkdirr*names r+rbz Testdir.mkdirs 4>//55666r-cPt|j|S)zSee :meth:`Pytester.mkpydir`.)r r)mkpydirrcs r+rfzTestdir.mkpydirs 4>11$77888r-cPt|j|S)z"See :meth:`Pytester.copy_example`.)r r) copy_examplercs r+rhzTestdir.copy_examples 4>66t<<===r-configc8|j||S)zSee :meth:`Pytester.getnode`.)r)getnode)r*riargs r+rkzTestdir.getnodes~%%fc222r-c6|j|S)z!See :meth:`Pytester.getpathnode`.)r) getpathnoder`s r+rnzTestdir.getpathnodes~))$///r-colitemsc6|j|S)zSee :meth:`Pytester.genitems`.)r)genitems)r*ros r+rqzTestdir.genitemss~&&x000r-c6|j|S)zSee :meth:`Pytester.runitem`.)r)runitemrPs r+rszTestdir.runitems~%%f---r-c(|jj|g|RS)z&See :meth:`Pytester.inline_runsource`.)r)inline_runsource)r*rQ cmdlineargss r+ruzTestdir.inline_runsources.t~.vD DDDDr-c |jj|S)z%See :meth:`Pytester.inline_genitems`.)r)inline_genitemsr*rLs r+rxzTestdir.inline_genitemss-t~-t44r-r:no_reraise_ctrlcr|c(|jj|||dS)z See :meth:`Pytester.inline_run`.r{)r) inline_run)r*r:r|rLs r+r~zTestdir.inline_runs((t~( 75E    r-c&|jj|i|S)z)See :meth:`Pytester.runpytest_inprocess`.)r)runpytest_inprocessr[s r+rzTestdir.runpytest_inprocesss1t~14B6BBBr-c&|jj|i|S)zSee :meth:`Pytester.runpytest`.)r) runpytestr[s r+rzTestdir.runpytests't~'8888r-c |jj|S)z!See :meth:`Pytester.parseconfig`.)r) parseconfigrys r+rzTestdir.parseconfigs)t~)400r-c |jj|S)z$See :meth:`Pytester.parseconfigure`.)r)parseconfigurerys r+rzTestdir.parseconfigures,t~,d33r- test_funcc8|j||S)zSee :meth:`Pytester.getitem`.)r)getitem)r*rQfuncnames r+rzTestdir.getitems~%%fh777r-c6|j|S)zSee :meth:`Pytester.getitems`.)r)getitemsrPs r+rzTestdir.getitemss~&&v...r-c<|j|||S)z"See :meth:`Pytester.getmodulecol`.) configargswithinit)r) getmodulecol)r*rQrrs r+rzTestdir.getmodulecols(~** zH+   r-modcolrdc8|j||S)z%See :meth:`Pytester.collect_by_name`.)r)collect_by_name)r*rrds r+rzTestdir.collect_by_names~--fd;;;r-c .|jj||||fi|S)zSee :meth:`Pytester.popen`.)r)popen)r*cmdargsstdoutstderrstdinkws r+rz Testdir.popens'$t~#GVVUIIbIIIr-timeoutrc(|jj|||dS)zSee :meth:`Pytester.run`.r)r)run)r*rrrs r+rz Testdir.runs!t~!7G5IIIIr-c6|j|S)zSee :meth:`Pytester.runpython`.)r) runpython)r*scripts r+rzTestdir.runpythonrVr-c6|j|S)z!See :meth:`Pytester.runpython_c`.)r) runpython_c)r*commands r+rzTestdir.runpython_cs~))'222r-)rc&|jj|d|iS)z*See :meth:`Pytester.runpytest_subprocess`.r)r)runpytest_subprocess)r*rrLs r+rzTestdir.runpytest_subprocesss2t~2DJ'JJJr-$@stringexpect_timeoutz pexpect.spawnc:|j||S)z"See :meth:`Pytester.spawn_pytest`.r)r) spawn_pytest)r*rrs r+rzTestdir.spawn_pytests~**6.*QQQr-cmdc:|j||S)zSee :meth:`Pytester.spawn`.r)r)spawn)r*rrs r+rz Testdir.spawns~##C#GGGr-cd|jdS)Nz )r1r0s r+__repr__zTestdir.__repr__s+4;++++r-c*t|jSr()strr1r0s r+__str__zTestdir.__str__s4;r-)r&Nr()r)rzF)r)G__name__ __module__ __qualname____doc____test__rr!__annotations__r"boolr,propertyr r1r4r7r:setterrr>rr@rCrFrJrOrSrrrUrXrZr]r_rbrfrhrrrrrrkrnrrqrsrurxr~rrrrrrrrr subprocessPIPErrrrrfloatrrrrrzr-r+r r (sH#/K///&5NG555@E"""""$""""0 000X09k999X9''X'&&X& ^))^)+[+++X+@<@@@@&&&&**** J J J J J@k@@@@;;;;;000000E;EEEEG[GGGGHkHHHH222227[77779{9999>>>>>>3f3huT9_7M.N33330001eD)O&eZdZeededefdZdS)LegacyTestdirPluginr%r&c$t|dS)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+testdirzLegacyTestdirPlugin.testdirsx40000r-N)rrr staticmethodrrr rrzr-r+rrsJ 1(1w111 W\111r-rcZeZdZUdZeed<dddededdfd Zdd ed ede fd Z de fdZ dS)TempdirFactoryaBackward compatibility wrapper that implements :class:`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`. _tmppath_factoryFr#tmppath_factoryr$r&Nc2t|||_dSr()rr)r*rr$s r+r,zTempdirFactory.__init__s  y!!! /r-Tbasenamenumberedcvt|j||S)zTSame as :meth:`TempPathFactory.mktemp`, but returns a :class:`py.path.local` object.)r rmktempresolve)r*rrs r+rzTempdirFactory.mktemp#s/4077(KKSSUUVVVr-crt|jS)zYSame as :meth:`TempPathFactory.getbasetemp`, but returns a :class:`py.path.local` object.)r r getbasetemprr0s r+rzTempdirFactory.getbasetemp's+40<<>>FFHHIIIr-)T) rrrrrrrr,rr rrrzr-r+rrs&%%%FK000.0>B0 0000 WWsWdWkWWWWJ[JJJJJJr-rceZdZeeddedefdZeedede fdZ dS) LegacyTmpdirPluginsession)scoper7r&c|jjS)zFReturn a :class:`pytest.TempdirFactory` instance for the test session.)ri_tmpdirhandler)r7s r+tmpdir_factoryz!LegacyTmpdirPlugin.tmpdir_factory-s ~,,r-tmp_pathc t|S)aReturn a temporary directory path object which is unique to each test function invocation, created as a sub directory of the base temporary directory. By default, a new base temporary directory is created each test session, and old bases are removed after 3 sessions, to aid in debugging. If ``--basetemp`` is used then it is cleared each session. See :ref:`base temporary directory`. The returned object is a `legacy_path`_ object. .. note:: These days, it is preferred to use ``tmp_path``. :ref:`About the tmpdir and tmpdir_factory fixtures`. .. _legacy_path: https://py.readthedocs.io/en/latest/path.html r )rs r+r1zLegacyTmpdirPlugin.tmpdir4s*8$$$r-N) rrrrrrrrrr r1rzr-r+rr,s W9-->---\-  %%+%%% W\%%%r-rr*rdr&cFt||S)z{Return a directory path object with the given name. Same as :func:`mkdir`, but returns a legacy py path instance. )r rbrcs r+ Cache_makedirrLs tzz$'' ( ((r-c*t|jS)zO(deprecated) The file system path of the test module which collected this test.r r/r0s r+FixtureRequest_fspathrT ty ! !!r-c*t|jS)zThe directory from which pytest was invoked. Prefer to use ``startpath`` which is a :class:`pathlib.Path`. :type: LEGACY_PATH r startpathr0s r+TerminalReporter_startdirrY t~ & &&r-cNtt|jjS)zThe directory from which pytest was invoked. Prefer to use :attr:`invocation_params.dir `, which is a :class:`pathlib.Path`. :type: LEGACY_PATH )r rinvocation_paramsdirr0s r+Config_invocation_dirrcs  s41566 7 77r-cDtt|jS)zThe path to the :ref:`rootdir `. Prefer to use :attr:`rootpath`, which is a :class:`pathlib.Path`. :type: LEGACY_PATH )r rrootpathr0s r+Config_rootdirrns s4=)) * **r-cV|jr!tt|jndS)zThe path to the :ref:`configfile `. Prefer to use :attr:`inipath`, which is a :class:`pathlib.Path`. :type: Optional[LEGACY_PATH] N)inipathr rr0s r+Config_inifilerxs(.2\ C;s4<(( ) ) )tCr-c*t|jS)zThe path from which pytest was invoked. Prefer to use ``startpath`` which is a :class:`pathlib.Path`. :type: LEGACY_PATH rr0s r+Session_stardirrrr-typevaluec|dkrN|jJ|jjt|trt j|n|}fd|DSt d||)NpathlistcNg|]!}tt|z "Srz)r r).0xdps r+ z/Config__getini_unknown_type..s+???Q CQKK((???r-zunknown configuration type: )rparent isinstancershlexsplit ValueError)r*rdrr input_valuesrs @r+Config__getini_unknown_typers~ z|''' \ -7s-C-CNu{5))) ????,????>>>FFFr-c*t|jS)z4(deprecated) returns a legacy_path copy of self.pathrr0s r+ Node_fspathrrr-c.t||_dSr()rr/)r*rs r+Node_fspath_setrsU DIIIr-T)tryfirst early_configct}||j|tdt d|t dttd|tdttd|tdttd|tdttd|tdttd|tdtt d|td t"|t$dtt&t(dd S) zLMonkeypatch legacy path attributes in several classes, as early as possible.makedirFraisingfspathstartdirinvocation_dirrootdirinifile_getini_unknown_typeN)r add_cleanupundosetattrr rrrrrrrrrrrrrrrr)rmps r+pytest_load_initial_conftestsrsj BRW%%%JJuiJ>>>JJ~x2G)H)HRWJXXXJJ*h/H&I&ISX JJv'2G)H)HRWJXXXJJvy(>":":EJJJJJJvy(>":":EJJJJJJw H_$=$=uJMMMJJv-/JKKKJJtXx _EEuJUUUUUr-ricT|jdrt}||j |j}t |d}||d|dn#t$rYnwxYw|j tddSdS) zKInstalls the LegacyTmpdirPlugin if the ``tmpdir`` plugin is also installed.r1Tr#rFr zlegacypath-tmpdirN) rA has_pluginrrr_tmp_path_factoryrrAttributeErrorregisterr)rirtmp_path_factoryrs r+pytest_configurers&&x00O ]]27###  P%7  ,,<MMMN JJv/J O O O O     D  %%&8:MNNNNN#OOsA66 BBpluginmanagerc||du}|r7|ts|tddSdSdS)Nr%zlegacypath-pytester) get_plugin is_registeredrr)rr  is_pytesters r+pytest_plugin_registeredr%srG..z:::KE7001DEEE,.CDDDDDEEEEr-)Cr dataclassesrrpathlibrtypingrrrr iniconfigr_pytest.cacheproviderr _pytest.compatr r r _pytest.configrrr_pytest.deprecatedr_pytest.fixturesrr _pytest.mainr_pytest.monkeypatchr _pytest.nodesrrr_pytest.pytesterrrr_pytest.terminalr_pytest.tmpdirrtyping_extensionsrpexpectr r dataclassrrrrrrrrrrrrrrrobjectr%rzr-r+r9sFEE  $$$$$$'''''' &&&&&&&&&&&&!!!!!!######......------$$$$$$++++++ ++++++######))))))%%%%%%&&&&&&------******''''''NNNU U U U U U U U p 1 1 1 1 1 1 1 1 JJJJJJJJ8%%%%%%%%@))S)[))))"";"""" '$4'''''88;8888++K++++DDH[$9DDDD'''k'''' G G G',S$s)^'< G G G G"d"{"""" ${t 4VV4VVVV> OVOOOO O, EVE6IEdEEE EEEr-