bgSdZddlZddlZddlZddlmZddlmZddlmZddlm Z ddlm Z ddlm Z dd lm Z dd lm Z d d lmZd d lmZd dlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*dZ+dZ,eej-Gdd Z.Gd!d"Z/Gd#d$Z0Gd%d&Z1Gd'd(Z2d)ed*dfd+Z3d,ed*e e e4effd-Z5ed./d,ed*dfd0Z6e!d1e"d*e.fd2Z7d,ed*e e8fd3Z9d,ed4e$d*e4fd5Z:dS)6z%Implementation of the cache provider.N)Path)Dict) Generator)Iterable)List)Optional)Set)Union)resolve_from_str)rm_rf) CollectReport)nodes)TerminalWriter)final)Config)ExitCode)hookimpl)Parser)check_ispytest)fixture)FixtureRequest)Session)File)Package) TestReporta.# pytest cache directory # This directory contains data from the pytest's cache plugin, which provides the `--lf` and `--ff` options, as well as the `cache` fixture. **Do not** commit this to version control. See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information. sSignature: 8a477f597d28d172789f06886806bc55 # This file is a cache directory tag created by pytest. # For information about cache directory tags, see: # https://bford.info/cachedir/spec.html c reZdZUdZejdZeed<ejdZ e ed<dZ dZ ddd ed e d e d d fdZeddd e d e d dfdZedd ed e d d fdZeddd e d e d efdZddded e ded d fdZded efdZded efdZdefdZdeded d fdZddZd S)Cachez Instance of the `cache` fixture.F)repr _cachedir_configdv _ispytestcachedirconfigr%returnNc@t|||_||_dSN)rr r!)selfr&r'r%s f/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/_pytest/cacheprovider.py__init__zCache.__init__Cs$ y!!!! ct|||d}|dr+|r||d|||dS)zHCreate the Cache instance for a Config. :meta private: Tr$ cacheclear)rcache_dir_from_config getoptionis_dir clear_cache)clsr'r%r&s r, for_configzCache.for_configJs~ y!!!,,Vt,DD   L ) ) 6hoo.?.? 6 OOHO 5 5 5s8Vt4444r.ct||j|jfD]*}||z }|rt |+dS)zfClear the sub-directories used to hold cached directories and values. :meta private: N)r_CACHE_PREFIX_DIRS_CACHE_PREFIX_VALUESr3r )r5r&r%prefixr"s r,r4zCache.clear_cacheVs\ y!!!-s/GH  F6!Axxzz a  r.cpt|t|d|jS)zRGet the path to the cache directory for a Config. :meta private: cache_dir)rr getinirootpath)r'r%s r,r1zCache.cache_dir_from_configbs0 y!!! k : :FOLLLr.fmtargsc t|ddl}ddlm}|||r |jdi|n||jjddS)z7Issue a cache warning. :meta private: rN)PytestCacheWarning) stacklevel)rwarnings_pytest.warning_typesrBwarnformatr!hook)r+r?r%r@rFrBs r,rHz Cache.warnks y!!!<<<<<<  TBzsz11D111s C C L       r.namect|}t|jdkrtd|j|j|}|dd|S)aReturn a directory path object with the given name. If the directory does not yet exist, it will be created. You can use it to manage files to e.g. store/retrieve database dumps across test sessions. .. versionadded:: 7.0 :param name: Must be a string not containing a ``/`` separator. Make sure the name contains your plugin or application identifiers to prevent clashes with other cache users. r z.name is not allowed to contain path separatorsTexist_okparents)rlenparts ValueErrorr joinpathr8mkdir)r+rKpathress r,rTz Cache.mkdirzsfDzz tz??Q  MNN Nn%%d&=tDD 4 ... r.keyc\|j|jt|Sr*)r rSr9r)r+rWs r, _getvaluepathzCache._getvaluepaths#~&&t'@$s))LLLr.c||} |dd5}tj|cdddS#1swxYwYdS#tt f$r|cYSwxYw)aReturn the cached value for the given key. If no value was yet cached or the value cannot be read, the specified default is returned. :param key: Must be a ``/`` separated value. Usually the first name is the name of your plugin or your application. :param default: The value to return in case of a cache-miss or invalid cache value. rUTF-8encodingN)rYopenjsonloadrROSError)r+rWdefaultrUfs r,getz Cache.gets!!#&& 311 $Qy|| $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $G$   NNN s4AA AAAAAA21A2valuec||} |jrd}n5|j}|jddn5#t $r(}|d|d|dYd}~dSd}~wwxYw|s|tj |dd } | d d }|5| |ddddS#1swxYwYdS#t $r(}|d |d|dYd}~dSd}~wwxYw)aNSave value for the given key. :param key: Must be a ``/`` separated value. Usually the first name is the name of your plugin or your application. :param value: Must be of any combination of basic python types, including nested types like lists of dictionaries. TrMzcould not create cache path z: r$NF) ensure_asciiindentwr\r]zcache could not write path ) rYparentr3r existsrTrbrH_ensure_supporting_filesr`dumpsr_write)r+rWrfrUcache_dir_exists_alreadyexcdatards r,setz Cache.sets!!#&& {!!## ?+/((+/>+@+@+B+B( !!4!>>>    II>>  # 00A                          II;d;;c;;           sBAA)) B3BB D%DD D  EEEc |jdz }|td|jd}d}||d|jd}|t dS)zOCreate supporting files in the cache dir that are not really part of the cache.z README.mdr\r]z .gitignorez%# Created by pytest automatically. * z CACHEDIR.TAGN)r write_textREADME_CONTENTrS write_bytesCACHEDIR_TAG_CONTENT)r+ readme_pathgitignore_pathmsgcachedir_tag_paths r,rnzCache._ensure_supporting_filessn{2 ~@@@00>>7!!#!888 N33NCC%%&:;;;;;r.)Fr(N)__name__ __module__ __qualname____doc__ dataclassesfieldr r__annotations__r!rr8r9boolr- classmethodr6r4 staticmethodr1strobjectrHrTrYrertrnrEr.r,rr5s\+*'k'U333It333'k'U333GV333DI&,<@ =B 5 5 5 5d 5w 5 5 5[ 5  4 D T   [ CHMMMfMDMTMMM\M38      4    D     #$*MMMMMMs&#s#6#d####J < < < < < .sort_keys3dG,,%9+DD9Dx''r.TrWreversec3*K|] }|jvVdSr*nodeid).0x lastfaileds r, zALFPluginCollWrapper.pytest_make_collect_report..s*FF!qx:5FFFFFFr.zlfplugin-collskipcg|]A}|jvs4|jst|tj?|BSrE)r isinitpathrUrr Collector)rrrsessions r, zBLFPluginCollWrapper.pytest_make_collect_report..s^x:--))!&11."!U_55 .---r.)rrr get_resultr_last_failed_pathsr rItemrrsortedresultrrUrranyr' pluginmanagerregisterLFPluginCollSkipfilesr) r+routrVrrrrrs @@@r,pytest_make_collect_reportz.LFPluginCollWrapper.pytest_make_collect_reports i'7!3 4 41 %%C!$!1!1C}7H (uUZ%@A (d ( ( ( ( ( (  CJ F  4 ( ( ~!AAAeenn&&!]5 ;@FFFFvFFFFFM(6??-dm<<>Q<@D8#+#qqq  r.rrr(N)rrrr-rrrrrEr.r,rrs_5555X$3EO333 333r.rcLeZdZddZedejdeefdZ dS) rrrr(Nc||_dSr*)rrs r,r-zLFPluginCollSkipfiles.__init__s   r.rct|trUt|ts@|j|jjvr-|jxjdz c_t|jddgSdS)Nr passed)longreprr) rrrrUrr_skipped_filesrr)r+rs r,rz0LFPluginCollSkipfiles.pytest_make_collect_reportsy i & & z)W/M/M ~T]%EEE ,,1,,$$hbtr.r) rrrr-rrrrrrrEr.r,rrs_!!!!   -    X   r.rceZdZdZdeddfdZdeefdZde e fdZ de ddfd Z deddfd Zed d ded eejdedfdZdeddfdZdS)rz;Plugin which implements the --lf (run last-failing) option.r'r(Nc|_d}tfd|D|_jsJjdi|_d|_d|_d|_ drC| |_ j t|ddSdS)N)lf failedfirstc3BK|]}|VdSr*)r2)rrWr's r,rz$LFPlugin.__init__..-s1GGC&**3//GGGGGGr.cache/lastfailedrrzlfplugin-collwrapper)r'ractivecacherer_previously_failed_count_report_statusrr2get_last_failed_pathsrrrr)r+r' active_keyss ` r,r-zLFPlugin.__init__*s ) GGGG;GGGGG ||+1<+;+;z1LFPlugin.get_last_failed_paths..Cs%000aQXXZZ0000r.)r'r>rtrsplitaddupdaterO)r+r>rrrUs r,rzLFPlugin.get_last_failed_paths:s;'o ( (Ffll40033D JJt    MM$, ' ' ' '0060000r.cd|jr(|jddkr d|jzSdS)Nverboserzrun-last-failure: %s)rr'r2r)r+s r,pytest_report_collectionfinishz'LFPlugin.pytest_report_collectionfinishEs: ; @4;00;;q@@)D,?? ?tr.reportc|jdkr|js|jr"|j|jddS|jrd|j|j<dSdS)NcallT)whenrskippedrpoprfailed)r+rs r,pytest_runtest_logreportz!LFPlugin.pytest_runtest_logreportJse K6 ! !fm ! ! O   t 4 4 4 4 4 ] 2-1DOFM * * * 2 2r.c|jdv}|rZ|j|jvrJ|j|j|jd|jDdSdSd|j|j<dS)N)rrc3(K|] }|jdfVdS)TNrritems r,rz0LFPlugin.pytest_collectreport..Us)&U&Ut T':&U&U&U&U&U&Ur.T)outcomerrrrr)r+rrs r,pytest_collectreportzLFPlugin.pytest_collectreportPs#88  2}//##FM222&&&U&Uv}&U&U&UUUUUU0/.2DOFM * * *r.TrtryfirstitemsNNNc#KdV|jsdS|jrTg}g}|D];}|j|jvr||&||??6II##'??## --E!!!H-===aaa##'??####r.rc|j}|dst|drdS|jJ|jdi}||jkr"|jd|jdSdS)N cacheshow workerinputr)r'r2hasattrrrerrt)r+rr'saved_lastfaileds r,pytest_sessionfinishzLFPlugin.pytest_sessionfinishs   K ( ( GFM,J,J  F|'''!<++,>CC t . . L  / A A A A A / .r.)rrrrrr-r rrrrrrrrrrrrrrrrrrEr.r,rr'sEEEv$ 1s4y 1 1 1 1  2z2d2222 2=2T2222X$...1@1@%)%*%51@ # $1@1@1@/.1@fBGBBBBBBBr.rceZdZdZdeddfdZedddeej de d fd Z de ej deej fd Z d d ZdS)NFPluginz8Plugin which implements the --nf (run new-first) option.r'r(Nc||_|jj|_|jJt |jdg|_dS)N cache/nodeids)r'optionnewfirstrrrtrecached_nodeidsr+r's r,r-zNFPlugin.__init__sK m, |'''!&,"2"2?B"G"GHHr.Trrrc#KdV|jri}i}|D]%}|j|jvr |||j<|||j<&||||z|dd<|j|dS|jd|DdS)Nc3$K|] }|jV dSr*rrs r,rz9NFPlugin.pytest_collection_modifyitems..s$&E&Ett{&E&E&E&E&E&Er.)rrr_get_increasing_ordervaluesr)r+r new_items other_itemsrs r,rz&NFPlugin.pytest_collection_modifyitemss  ; F/1I13K 4 4;d&999-1Idk**/3K ,,11  ""**;+=+=+?+?@@AE!!!H   & &y 1 1 1 1 1   & &&E&Eu&E&E&E E E E E Er.c(t|ddS)Nc>|jjSr*)rUstatst_mtime)rs r,z0NFPlugin._get_increasing_order..sdinn.>.>.Gr.Tr)r)r+rs r,rzNFPlugin._get_increasing_orderse!G!GQUVVVVr.c|j}|dst|drdS|drdS|jJ|jdt |jdS)Nrr collectonlyr)r'r2rrrtrrrs r,rzNFPlugin.pytest_sessionfinishs   K ( ( GFM,J,J  F   M * *  F|''' &1D*E*EFFFFFr.r~)rrrrrr-rrrrrrrrrrEr.r,rrsBBIvI$IIII X$...F%*%F # $FFF/.F*W8EJ+?WDDTWWWW G G G G G Gr.rparserr(c |d}|ddddd|dd dd d |d d ddd|ddddd|ddddd}dtjvr0tjtjd|}|d|d|ddd d!d"d#d$%dS)&Ngeneralz--lfz --last-failed store_truerzHRerun only the tests that failed at the last run (or all if none failed))actiondesthelpz--ffz--failed-firstrzyRun all tests, but run the last failures first. This may re-order tests and thus lead to repeated fixture setup/teardown.z--nfz --new-firstrzORun tests from new files first, then the rest of the tests sorted by file mtimez --cache-showr?rz_Show cache contents, don't perform collection or tests. Optional argument: glob (default: '*').)rnargsrrz --cache-clearr0z.Remove all cache contents at start of test run .pytest_cache TOX_ENV_DIRr<zCache directory path)rcrz--lfnfz--last-failed-no-failuresstorer)allrrz6Which tests to run with no previously (known) failures)rrchoicesrcr)getgroup addoptionosenvironrUjoinaddini)rgroupcache_dir_defaults r,pytest_addoptionr$sy OOI & &E OO 2  OO +  OO   OO  6     OO  =  ( ""GLLM)BDUVV MM+'8?UMVVV OO# & Er.r'cd|jjr#|jjsddlm}||tSdS)Nr) wrap_session)rrr _pytest.mainr&)r'r&s r,pytest_cmdline_mainr(sD }/v}'9/------|FI... 4r.T)rct|d|_|jt |d|jt |ddS)NTr$rnfplugin)rr6rrrrr)r's r,pytest_configurer+sd##Fd#;;FL !!(6"2"2J??? !!(6"2"2J?????r.requestc6|jjJ|jjS)abReturn a cache object that can persist state between testing sessions. cache.get(key, default) cache.set(key, value) Keys must be ``/`` separated strings, where the first part is usually the name of your plugin or application to avoid clashes with other cache users. Values can be any object handled by the json stdlib module. )r'r)r,s r,rrs  >  + + + > r.c|jjdks|ddkrH|jJ|jj} ||j}n#t$r|}YnwxYwd|SdS)z6Display cachedir with --cache-show and if non-default.rr<rN cachedir: )rrr=rr relative_tor>rR)r'r& displaypaths r,pytest_report_headerr2s }q  FMM+$>$>/$Q$Q|'''<) #"..v??KK # # #"KKK #)K))) 4sA A*)A*rcddlm}|jJt}|dt |jjz|jjs|ddS|jj d}|d}t}|jj}|tj z }| dd|ztd||DD]}t ||} |j| |} | |ur|d | z\|d | z|| D]} |d | z|tjz } | rt| |} | dd |z| D]j}|rTt ||} || d |jdkdS)Nr)pformatr/zcache is empty*-zcache values for %rc3BK|]}||VdSr*)is_filers r,rzcacheshow..Bs/EEE!EEEEEEr.z/%s contains unreadable content, will be ignoredz %s contains:z zcache directories for %rz is a file of length r")pprintr4rrlinerr r3rrrrr9seprrglobr0re splitlinesr8r8r st_size)r'rr4twglobdummybasedirvdirvalpathrWvalr:ddircontentsps r,rr/sy < # # #   BGGL3v|566 6777 < ! ( ( * *  !!!q = "1 %D | HHEl$G U/ /DFF3%,---EETZZ%5%5EEEEE%%'%%d++,,lsE** %<< GGEK L L L L GGNS( ) ) ) //11 % %t $$$$ % U- -D {{}}K$**T**++ s.5666 K KAyy{{ K!--00113IIQVVXX5EIIIJJJ 1r.);rrr`rpathlibrtypingrrrrrr r r r reportsr_pytestr _pytest._ior_pytest.compatr_pytest.configrrr_pytest.config.argparsingr_pytest.deprecatedr_pytest.fixturesrrr'r _pytest.nodesr_pytest.pythonr_pytest.reportsrrwry dataclassrrrrrr$intr(r+rrr2rrEr.r,rXs++ %%%%%%""""""&&&&&& !!!!!!############,,,,,,------$$$$$$++++++ """"""&&&&&&  ]<]<]<]<]<]<]<]<@99999999x(nBnBnBnBnBnBnBnBb+G+G+G+G+G+G+G+G\7V77777t8E#x-4H+I 4@V@@@@@    >  e         HSM     ' f' w' 3' ' ' ' ' ' r.