j7irdZddlmZddlZddlmZddlmZddlmZddlm Z ddlm Z ddl Z ddl Z dd l mZddlZdd lmZddlZddlZddlZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlZddlZddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+Zddl,m-Z-ddl.m/Z/ddl.m0Z0ddl.m1Z1ddl.m2Z2ddl3m4Z4ddl5m6Z6dd l5m7Z7dd!l8m9Z9dd"l8m:Z:dd#l;mZ>erdd&l?m@Z@d'ZAd(ZBd)ZCGd*d+ejZEGd,d-eZFdGd.ZGdHd/ZHdId0ZIe2d12dJd3ZJe jGd4d5ZLeGd6d7ZMdKd8ZNdLd9ZO dMd:ZP dNd;ZQdd>ds@r?r3r3Ps  %          ,%) =' =& =. = " =  =r@r3c0eZdZUdZded<ded<ded<y)TestShortLogReportuGUsed to store the test status result category, shortletter and verbose word. For example ``"rerun", "R", ("RERUN", {"yellow": True})``. :ivar category: The class of result, for example ``“passed”``, ``“skipped”``, ``“error”``, or the empty string. :ivar letter: The short letter shown as testing progresses, for example ``"."``, ``"s"``, ``"E"``, or the empty string. :ivar word: Verbose word is shown as testing progresses in verbose mode, for example ``"PASSED"``, ``"SKIPPED"``, ``"ERROR"``, or the empty string. rLcategoryletterz$str | tuple[str, Mapping[str, bool]]wordN)rSrTrUrV__annotations__r@r?rYrYus M K ..r@rYc |jddd}|jddddd d |jd d ddd |jdd ddd |jddddd|jdd ddd|jddtdd d |jd d tdd!"|jd#d$d%t d&d'(|jd)d*dd+d d,-|jd.d/d d0dd1|jd2dd0d34|jd5d6d$d7d8gd9d:;|jd|jd?d$d@gdAdBdCD|jdEdFd ddGH|jdIdJd$dJd8gdKdL;|jdMdNdNdOgdPQ|j dRdSdTUtj|tjdVWy)XNzterminal reporting Reportinggeneral)afterz-vz --verbosecountrverbosezIncrease verbosity)actionr8r6r:z --no-header store_trueF no_headerzDisable headerz --no-summary no_summaryzDisable summaryz--no-fold-skipped store_false fold_skippedTz+Do not fold skipped tests in short summary.)rer6r8r:z--force-short-summaryforce_short_summaryz=Force condensed summary output regardless of verbosity level.z-qz--quietzDecrease verbosityz --verbosityzSet verbosity. Default: 0.)r6typer8r:z-rstore reportcharscharsaShow extra test summary info as specified by chars: (f)ailed, (E)rror, (s)kipped, (x)failed, (X)passed, (p)assed, (P)assed with output, (a)ll except passed (p/P), or (A)ll. (w)arnings are enabled by default (see --disable-warnings), 'N' can be used to reset the list. (default: 'fE').)rer6r8metavarr:z--disable-warningsz--disable-pytest-warningsdisable_warningszDisable warnings summary)r8r6rer:z-lz --showlocals showlocalsz/Show locals in tracebacks (disabled by default)z--no-showlocalszFHide locals in tracebacks (negate --showlocals passed through addopts))rer6r:z--tbstyletbstyleauto)rulongshortnolinenativez5Traceback print mode (auto/long/short/line/native/no))rprer6r8choicesr:z --xfail-tbxfail_tbz1Show tracebacks for xfail (as long as --tb != no)z--show-capture showcapture)rxstdoutstderrlogallrzOControls how captured stdout/stderr/log is shown on failed tests. Default: all.)rer6r{r8r:z --fulltracez --full-tracez,Don't cut any tracebacks (default is to cut))rer8r:z--colorcolor)yesrxruz#Color terminal output (yes/no/auto)z--code-highlightrrxzSWhether code should be highlighted (only if --color is also enabled). Default: yes.)r8r{r:console_output_stylezConsole output: "classic", or with additional progress information ("progress" (percentage) | "count" | "progress-even-when-capture-no" (forces progress even when capture=no)progress)r:r8zSpecify a verbosity level for test case execution, overriding the main level. Higher levels will provide more detailed information about each test case executed.)r:) getgroup _addoption addoptionr3int_REPORTCHARS_DEFAULTaddinir_add_verbosity_iniVERBOSITY_TEST_CASES)rFgroups r?pytest_addoptionrs OO0+YO OE    !  OO    OO    OO  :  OO " L     !  OO   )    $>   OO#  '     >  OO  U   OO A D OO  @  OO 8  OO ;  OO % 2 OO   MM)  ## b r@c~t|tj|jj d|j j s|j jr+fd}|jjjd|tjdk(r|jjdyy)Nterminalreportercldjtt|}jd|zy)N z[traceconfig] )joinmaprL write_line)tagsargsmsgreporters r?mywriterz"pytest_configure..mywriter's+((3sD>*C    03 6 7r@z pytest:configwin32terminalprogress) TerminalReportersysr~ pluginmanagerregisteroptiondebug traceconfigtraceroot setprocessorplatform import_plugin)configrrs @r?pytest_configurer"s 3H !!(,>? }}fmm77 8  &&A ||w**+=>r@cR|jj}ddh}d}|D]8}||vr|j}|dk(rd}|dk(rd}'|dk(rd}/||vs4||z }:|jjs d |vrd |z}|S|jjrd |vr|j d d}|S) NFSasxXEfAPpsxXEfNw)rrnlowerrqreplace)rrn old_aliases reportoptschars r? getreportoptr3s}}00K*KJ  ; ::>G {{667h;N FGMMO ++r@cNeZdZUdZded<dZded<dZded<d Zd ed <d d Zy) WarningReportaoSimple structure to hold warnings information captured by ``pytest_warning_recorded``. :ivar str message: User friendly message about the warning. :ivar str|None nodeid: nodeid that generated the warning (see ``get_location``). :ivar tuple fslocation: File system location of the source of the warning (see ``get_location``). rLmessageNrOnodeidztuple[str, int] | None fslocationTr count_towards_summaryc|jr |jS|jr?|j\}}t|jjt |}|d|Sy)zSReturn the more user-friendly information about the location of a warning, or None.:N)rrr"invocation_paramsdirr!)r=rfilenamelinenumrelpaths r? get_locationzWarningReport.get_locationnsY ;;;;  ?? $ Hg!&":":">"> X@VWGYay) )r@)rrrPrO) rSrTrUrVr]rrrrr^r@r?rr\s3LFJ)-J&-&*8*r@rceZdZdUdVdZ dWdZedXdZedYdZedYdZedYdZ edYdZ e jdZd Z edYd Z edXd Z d[d Zd\d Zd]d^dZd_dZdddd d`dZdddadZdddbdZd_dZdcdZdddZ de dfdZdgdhdZdidZdjdZdkdZ dld Zdmd!Zdnd"Z dod#Z dpd$Z!edYd%Z"e#d&'dqd(Z$drd)Z%d_d*Z&d_d+Z'edXd,Z(d_d-Z)dsd.Z*dtdud/Z+e#d&0dvd1Z, dwd2Z-dxd3Z.dvd4Z/dnd5Z0e#d&' dyd6Z1e#d&'dzd7Z2d{d8Z3d_d9Z4d_d:Z5 d|d;Z6d<Z7d=Z8d}d>Z9d_d?Z:d_d@Z;d_dAZ< d~dBZ=ddCZ>ddDZ?ddEZ@d_dFZAd_dGZBddH ddIZCd_dJZDddKZEd_dLZFd_dMZGddNZHddOZId_dPZJddQZKddRZL ddSZM ddTZNy)rNcddl}||_d|_d|_d|_i|_d|_d|_|jj|_ |tj}|jj|||_|jj|_d|_t%||_|j(j*|_|jj.|_t1j2|j5|_t7|_t7|_|j=|_tAjB|_"d|_#d|_$yNr)%_pytest.configr _numcollected_session _showfspathstats _main_color _known_typesrr startpathrr~create_terminal_writer_tw fullwidth _screen_width currentfspathrrnrrj foldskipped hasmarkupr CallableBoolisattyset_progress_nodeids_reported_timing_nodeids_reported_determine_show_progress_info_show_progress_inforInstant_collect_report_last_write_already_displayed_warnings_keyboardinterrupt_memo)r=rfile_pytests r?r<zTerminalReporter.__init__{s (, (,+- '+.21155 <::D>>88F!XX//6:'/!==55++))$++-8 47E'25%%#'#E#E#G *0..*:'7;(=A$r@c|jjdddk(r|jjddk7ry|jjddry|jjd}|dvry|d k(ry |d k(ry y) zRReturn whether we should display progress information based on the current config.capturerxrprogress-even-when-capture-noF setupshow>rrrrctimes)r getoptiongetini)r=cfgs r?rz.TerminalReporter._determine_show_progress_infos KK ! !)T 2d : ""#9:./ ;; e 4;;%%&<= ? ? G^ G^r@cF|jjj}|SrR)rrrd)r= verbositys r?rzTerminalReporter.verbositys++33 r@c |jdk\Sr)rr=s r? showheaderzTerminalReporter.showheaders~~""r@cTt|jjjSrR)rNrrrgrs r?rgzTerminalReporter.no_headersDKK&&0011r@cTt|jjjSrR)rNrrrhrs r?rhzTerminalReporter.no_summarysDKK&&1122r@c|j,|jjtjdk\S|jSr)rr get_verbosityrrrs r? showfspathzTerminalReporter.showfspaths:    #;;,,V-H-HIQN Nr@c||_yrR)r)r=values r?rzTerminalReporter.showfspaths  r@cZ|jjtjdkDSr)rrrrrs r?showlongtestinfoz!TerminalReporter.showlongtestinfos"{{(()D)DEIIr@c,t|jS)zUThe amount of items reported in the progress so far. :meta private: )lenrrs r?reported_progressz"TerminalReporter.reported_progresss 42233r@cHdddj||}||jvS)Nxr)r+r))getrn)r=rs r?hasoptzTerminalReporter.hasopts*3/33D$?t''''r@c |jj|jddz }|j||jk7r}|j|jr|j ||_t |j|}|jj|jj|dz|jj|fddi|y)N::rrflushT) rrootpathsplitrr)_write_progress_information_filling_spacer"rrrywrite)r=rresmarkupfspath relfspaths r?write_fspath_resultz$TerminalReporter.write_fspath_results%% T(:1(==    %43E3E)E!!-$2J2J>>@!'D #DNNF;I HHMMO HHNN9s? +s1$1&1r@c |j|k7r<|jj||_|jj||r%|jj|fi|d|_yy)N)rrryr)r=prefixextrakwargss r?write_ensure_prefixz$TerminalReporter.write_ensure_prefixs\    ' HHMMO!'D  HHNN6 "  DHHNN5 +F +!#D  r@c`|jr"|jjd|_yyrR)rrryrs r?ensure_newlinezTerminalReporter.ensure_newlines%    HHMMO!%D  r@F )rmarginline_sepc |jj}|jtjd|z|z|j |z dd}||d}|jj |fd|i|y)z+Wrap message with margin for progress info.rTF)widthdrop_whitespacereplace_whitespaceNr)rwidth_of_current_linertextwrapwraprr)r=contentrr*r+rr0wrappeds r? wrap_writezTerminalReporter.wrap_writes|!% > >-- MM++g5((61 $#(   /01w6e6v6r@rc B|jj|fd|i|y)Nr)rr)r=r3rrs r?rzTerminalReporter.write sw6e6v6r@c>|jj||y)Nr6)r write_raw)r=r3rs r?r9zTerminalReporter.write_raws 7%0r@c8|jjyrR)rrrs r?rzTerminalReporter.flushs r@c t|ts t|d}|j|jj|fi|y)Nr)errors) isinstancerLr'rry)r=ryrs r?rzTerminalReporter.write_lines;$$tI.D  d%f%r@c |jdd}|r+|jjt|z dz }d|z}nd}t |}|jj d|z|zfi|y)a-Rewinds the terminal cursor to the beginning and writes the given line. :param erase: If True, will also add spaces until the full terminal width to ensure previous lines are properly erased. The rest of the keyword arguments are markup instructions. eraseFrBrr N)poprrrrLr)r=ryrr? fill_countfills r?rewritezTerminalReporter.rewritesl 7E* ++c$i7!;J#DD4ytd{T)4V4r@c b|j|jj|||fi|yrR)r'rsep)r=rFtitlerrs r? write_sepzTerminalReporter.write_sep-s+  S%5f5r@c @|jj||fi|yrR)rrF)r=rGrFkws r?sectionzTerminalReporter.section7s S%&2&r@c >|jj|fi|yrR)rry)r=rrJs r?ryzTerminalReporter.line:s c R r@c||jv}|jj|gj||r|jyyrR)r setdefaultextend_set_main_color)r=rZitemsset_main_colors r? _add_statszTerminalReporter._add_stats=sC!3 h+2259   " r@cjt|jdD]}|jd|zy)Nr)zINTERNALERROR> T)rLrr)r=excreprrys r?pytest_internalerrorz%TerminalReporter.pytest_internalerrorCs5L&&t, 6D OO-4 5 6r@cddlm}|j|jf}||}t |||}|j d|gy)Nr)warning_record_to_str)rrrr-)_pytest.warningsrXrlinenorrS)r=warning_messagerrXrrwarning_reports r?pytest_warning_recordedz(TerminalReporter.pytest_warning_recordedHsK ;$--/E/EE '8&!76   ^$45r@cr|jjjrd|}|j|yy)NzPLUGIN registered: )rrrr)r=pluginrs r?pytest_plugin_registeredz)TerminalReporter.pytest_plugin_registeredWs4 ;;   ) )'x0C OOC *r@c(|jd|y)Nr*)rS)r=rQs r?pytest_deselectedz"TerminalReporter.pytest_deselected_s  e,r@c|\}}}|jr7|j||||}|j|d|jy|jr#|j |d|jyy)Nr)r  _locationliner%rrr)r=rlocationrrZdomainrys r?pytest_runtest_logstartz(TerminalReporter.pytest_runtest_logstartbso"*  %%ffffED  $ $T2 . JJL __  $ $VR 0 JJLr@c.d|_|}t|jjj ||j}|j |j |j}}}t|tsd}n|\}}|j||g|s|sy|Vt|d}|jr|sddi}n7|jr|rddi}n$|jrddi}n|jrddi}ni}|jj!|j"|jj%t&j(dkrI|j*j,|fi||j.r|j0s|j3n|j4|j"g|j6} t|d} | s|j8| |fi||js t|drt;|} |jj%t&j(d krJ|j*j<|j*j>z tAd z d z } tCd | | } nd | d} | r| |jE| |j.r|jGn|jI|j*j-d|jJjLjNd|j.r/|j*j-|jQdzdn|j*j-d|j*j,|fi||j*j-d| zd|_)|jUy)NT)rrwasxfailgreenyellowredrnode [100%]rBz ({})z ()[]r)cyanr!)+ _tests_ranrYrhookrrZr[r\r=tuplerShasattrr(r'r)raddrrrrrrr _is_last_item(_write_progress_information_if_past_edgerdrer%_get_raw_skip_reasonrr0r_format_trimmedr5rr'rmgatewayid!_get_progress_information_messagerr)r=rreprrZr[r\r was_xfailry running_xdistreasonavailable_widthformatted_reasons r?pytest_runtest_logreportz)TerminalReporter.pytest_runtest_logreportps [[   6 6c$++ 6 V "%szz388$&$&FLD& 3%(d  > 3Izz)!4 "D)"D) ''++CJJ7 ;; $ $V%@%@ AQ F DHHNN6 ,V ,''0B0B==?%4%%cjj@3<<@D#C0M (((t>v>;;'&*"=1#6F{{001L1LMPQQ!XX//$((2P2PP!)n- ( ,;#V_,(.0xq>("2">(89++BBD##%388#3#3#6#6"7q9:++HHNN>>@3FT#HHNN3't.v.sTz*%'" r@cd|jJ|j|jjk(SrR)rrtestscollectedrs r?ryzTerminalReporter._is_last_items-}}(((%%)E)EEEr@T)wrapperc#Kd}|jjtjdkr(|jr|j r|j |Swr)rrrrrrr)r=results r?pytest_runtestloopz#TerminalReporter.pytest_runtestloopsM KK % %f&A&A Ba G((&&  : : < sAAc |jsJ|jj}|jdk(rG|r<|j}dt t |d}d|d}|j ||Sd|d|dS|jd k(rG|sy |jd |jd z|jd z|jdz|jdz|jdz|jd z}|djd |Dcgc]}|j|jvs|}}t fd|jjD}t fd|D} | |k(} |js| r=|jjd|Dttd|DSy |rd|jdz|zddSycc}w)Nrcz{:zd} [z/{}]z [  / z ]rrr(r,r'r+r)r.rc3BK|]}|jdk(yw)rN)re).0icurrent_locations r? zETerminalReporter._get_progress_information_message..s$"67 1 !11"sc3`K|]%}|jdk(r|jdk('yw)rrN)rer)rrrs r?rzETerminalReporter._get_progress_information_message..s3"::a=$44'!"s+.c34K|]}|jywrR)rrrs r?rzETerminalReporter._get_progress_information_message..s4T!QXX4Tsc3VK|]!}t|ts|j#ywrR)r=r%durationrs r?rzETerminalReporter._get_progress_information_message..sVqJq*':&;3!?"$^$4F ; $++Hi@@ 3yk4 4  # #w .,,X6..y9:..x89..y9:..y9 : ..w7 8 ..r2 3  +277: &!(($:W:W*WL"";?==;N;N"O""%"O -?N$$--444T|4TT+VLVV ..4 A"ERH H)s "G-G-c|j}|jdk(r7|jsJ|jj}t d|d|d}n&|jdk(r t d}n t d}||zdz|j k\}|rF|j \}}|j}|jj|d zfi|d iyy) Nrcr/rrrz 99h 59mrorBr)T) _width_of_current_linerrrrr_get_main_colorrrr)r=r num_testsprogress_length past_edge main_color_rs r?rzz9TerminalReporter._write_progress_information_if_past_edges  ' '  # #w .== = 44I!Byk9+Q"?@O  % % 0!*oO!)nO'!+t/A/AA  002MJ88:C DHHNN3: <*d); < r@c|j\}}|j}|j}|jj|z dz }|j |j |fddi|diy)NrBrT)rrrrrrrjust)r=rrrrrCs r?rz:TerminalReporter._write_progress_information_filling_space sj'')q446  ' 'xx!!A%) 399T?@$@5$-@r@c.|jjS)z%Return the width of the current line.)rr0rs r?rz'TerminalReporter._width_of_current_linesxx---r@c|jr9|jjjdk\r|j dddyy|jjjdk\r|j dddyy)Nrzcollecting ... T)rboldrB)rrrrdrrs r?pytest_collectionz"TerminalReporter.pytest_collectionsk ;;={{!!))Q. ,Dt D/ [[   ' '1 , JJ(4J @-r@c^|jr|jd|gn|jr|jd|g|jDcgc]}t |t s|}}|xj t|z c_|jr|jyycc}w)Nr.r)) r'rSr)rr=rrrrreport_collect)r=rrrQs r?pytest_collectreportz%TerminalReporter.pytest_collectreports == OOGfX . ^^ OOIx 0"MMAqZ4-@AA c%j( ;;=    ! Bs B*$B*cX|jjjdkry|sE|jj j t krytj|_t|jjdg}t|jjdg}t|jjdg}|j|z }|rdnd}|t|jdz|jdk(rd nd zz }|r|d |d |dk7rd nd z }|r |d |d z }|r |d |dz }|j|kDr |d |dz }|jr)|j|dd|r|j!dyy|j#|y)Nrr.r)r*z collected z collecting z itemrBrrrz errorz deselectedz skippedz selectedT)rr?r))rrrdrelapsedsecondsREPORT_COLLECTING_RESOLUTIONrrrrrrrLrrDrr)r=r r<r)r*selectedrys r?rzTerminalReporter.report_collect)s ;;   % % ) //779AA./.4nn.>D +TZZ^^GR01djjnnY34 b9: %% 2$|- "" #g -t7I7IQ7NTW X   c&v{'CD DD  c*[1 1D  c'(+ +D    ( c(9- -D ;;= LLDL 5 4  OOD !r@rcx||_tj|_|jsy|j dddt j}|jsXdtj d|}ttdd}|r1djtt|dd }|d |d |d d z }|d tjj dt"j$z }|j&dkDsA|j(j*j,s!t|j(j*ddr|dttj.zz }|j1||j(j2j5|j(|j6}|j9|yy)N=ztest session startsTrz platform z -- Python pypy_version_inforz[pypy--rrz , pytest-z , pluggy-rpastebinz -- )r start_path)rrr_session_startrrHrpython_versionrgrrDrrrLr_versionversionpluggy __version__rrrr executablerrupytest_report_headerr_write_report_lines_from_hooks)r=sessionverinforrliness r?pytest_sessionstartz$TerminalReporter.pytest_sessionstartMsu $nn.  s1=))+~~cll^;wi@C '-@$ G  ((3s,=bq,A#BCy*;A*>)?qAA Yw//778 &BTBTAUV VC";;%%++4;;--z4@vCNN 333 OOC KK$$99{{t~~:E  / / 6#r@ct|D]<}t|tr|j|%|D]}|j|>yrR)reversedr=rLr)r=r line_or_linesrys r?rz/TerminalReporter._write_report_lines_from_hookshsH&e_ *M-- .)*DOOD)*  *r@c xd|jg}|jrbd}|jrddj|jd}|j dt |j|jz|z|j tjjk(r@|jd}|j djdj||jj}|r8|j d jdjt||S) Nz rootdir: rz% (WARNING: ignoring pytest config in , z!)z configfile: testpathsz testpaths: {}z plugins: {})rinipath_ignored_config_filesrappendr" args_sourcer ArgsSource TESTPATHSrrrlist_plugin_distinfo_plugin_nameversions)r=rrwarningr plugininfos r?rz%TerminalReporter.pytest_report_headerrsfoo./0 >>G++A$))FLhLhBiAjjlm MMV__fnn!MMPWW    !2!2!>@  MM$$TYY/CJ/O%PQ  r@c|jd|jjj|j|j|j }|j ||jjdr|j rY|jjjdkDr|jjd|j|j |jjd}|r?|jjdd|D]}|j!|jyyy) NT)rrrQ collectonlyrrr'!zcollection failures)rrrupytest_report_collectionfinishrrQrrrrdrry_printcollecteditemsrrrF toterminal)r=rrr'rs r?pytest_collection_finishz)TerminalReporter.pytest_collection_finishs D!   ??;;~~--@  ++E2 ;;  /}};;%%--2HHMM"%))'--8ZZ^^H-F S"78!-CNN488,- 0r@c |jjtj}|dkr|dkrTt d|D}t |j D]%\}}|jj|d|'y|D]'}|jj|j)yg}d}|D]}|jdd} |r%|| dt|k(rn|j|r%| t|dD]} |j| t|dz dz}|jj|| |dk\sJt| dd} | rtj | nd} | ss| j#D]0} |jjd j%|dz| 2y) Nrrc3ZK|]#}|jjddd%ywrrBrN)rr)ritems r?rz8TerminalReporter._printcollecteditems..s& Q4!2!24!;A!> Qs)+: rrB objz{}{})rrrrrsortedrQrryr listchainrrArrDinspectgetdoc splitlinesr)r=rQtest_cases_verbositycountsnamercrstackindentneeded_collectorscolrdocrys r?rz%TerminalReporter._printcollecteditemss#{{889T9TU ! ##b( Q5 QQ#)&,,.#96KD%HHMMTF"UG"456 "/DHHMM$++./  ND $ 0 4 -lE ;; )U6 N S!e*q.D0 ./'1,!#ud3C14'..-$C$'NN$4ND HHMM&-- t*LMN N  Nr@c#Kd}|jjdtjtjtj tj tjf}||vr>|js2|jjj|||j|jr'|jdt|jd|tj k(r|jd|_n3|j"r'|jdt|j"d|j%|Sw)Nr)r exitstatusrrT)rl)rryrOK TESTS_FAILED INTERRUPTED USAGE_ERRORNO_TESTS_COLLECTEDrhrrupytest_terminal_summary shouldfailrHrL_report_keyboardinterruptr shouldstop summary_stats)r=rrrsummary_exit_codess r?pytest_sessionfinishz%TerminalReporter.pytest_sessionfinishs   b KK  ! !    ' '   + +DOO KK   4 4!%*T[[ 5     NN3G$6$6 7TN B -- -  * * ,+/D (    NN3G$6$6 7TN B  sEEc#^K|j|j|j|j|j |j  d|j |jS#|j |jwxYwwrR)summary_errorssummary_failuressummary_xfailuressummary_warningssummary_passessummary_xpassesshort_test_summaryrs r?r z(TerminalReporter.pytest_terminal_summarys        $  # # %  ! ! #  # # %  ! ! #sA!B-$B'!B-"B**B-c2|jd|_y)NT)funcargs)getreprr)r=excinfos r?pytest_keyboard_interruptz*TerminalReporter.pytest_keyboard_interrupts'.'E$r@c>|j|jyyrR)rr rs r?pytest_unconfigurez#TerminalReporter.pytest_unconfigures  ' ' 3  * * , 4r@c|j}|J|jJ|jj}|jd|d|vr|jj j r|j|jy|jj|j|jjddyy)NrKeyboardInterruptz@(to show a full traceback on KeyboardInterrupt use --full-trace)T)rk) r reprcrashrrHrr fulltracerrry)r=rUrs r?r z*TerminalReporter._report_keyboardinterrupts.."""  ,,,'' sC # %{{!!++""488,!!,,TXX6 V &r@cd fd }|rv||}jdk\rZ|jdd|jdtjk7r%|dt j t|zz }|dzSd}|dzS) Ncjj|}r]|jrL|dt }j d}|dj dd|d<|dj |z }|S)Nrqrrr)rcwd_relative_nodeidendswithrrrr)rryrHrfr=s r?mkrelz-TerminalReporter._locationline..mkrelsw;;226:D$--/Ns6{l+c*"1I--c48q ((Kr@rnrr\z <- z [location]r)rrLrPrL)rrrrSEPr"rr )r=rrrZrfr'rs` ` r?rdzTerminalReporter._locationlines  -C~~"v||D'9!'<eiiA(v DNNDL IIISyCSyr@c$|j}|r|Sy)Nz test session) head_line)r=rr+s r?_getfailureheadlinez$TerminalReporter._getfailureheadlinesMM  r@c t|jjS#t$r, t|jddcYS#t$rYYywxYwwxYw)N2r)rLlongreprr!AttributeError)r=rs r? _getcrashlinezTerminalReporter._getcrashlinesX s||--. .  3<<("--!   s,! AAA AAAAcz|jj|dDcgc]}t|dr|c}Scc}w)Nr^ _pdbshown)rrrw)r=rrs r? getreportszTerminalReporter.getreports&s.::>>$3Sa71k;RSSSs88c(jdrjjd}|syjdu}|r|jd}n|}t |_|syi}|D]-}|j |j gj|/d fd }|rdnd}jd|dd |jD]\}} || } | rTjj| |j} d jd | D} | j}n|j}jj|jjjjd yy)Nrr-c>g}|D]1}|jj}|s!|j|3t|dkrdj t t |Std|D}dj d|jDS)N r)c3XK|]"}t|jddd$ywr)rLr)rlocs r?rzWTerminalReporter.summary_warnings..collapsed_location_report..Fs)-36CHNN4+A.-s(*c3VK|]!\}}dj|||dkDrdnd#yw)z{}: {} warning{}rBrrN)r)rkvs r?rzWTerminalReporter.summary_warnings..collapsed_location_report..Is3!1'--a1q5CbI!s')) rrrrrrrLrrQ)reports locationsrrecounts_by_filenamer=s r?collapsed_location_reportzDTerminalReporter.summary_warnings..collapsed_location_report<s  3A ~~dkk:H!((23 y>B&99Si%899%,-:C-&"yy! 2 8 8 :!r@zwarnings summary (final)zwarnings summaryrTF)rkrr)c3&K|] }d|z yw)rNr^)rrs r?rz4TerminalReporter.summary_warnings..Us(Aa(AszG-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html)r=zlist[WarningReport]rPrL)rrrrrrNrrrHrQrryrrrstrip) r= all_warningsr warning_reportsreports_grouped_by_messagewrr@rGrmessage_reportsmaybe_locationrindenteds ` r?rz!TerminalReporter.summary_warnings)sm ;;s 7;zz~~j7QL44D@E".t/O/O/Q"R"./2?/CD ,"IK &% Q*55bjj"ELLRP Q $38.=OE NN3dN ?,F,L,L,N (!:?!K!HHMM.1#..0E#yy(A5(AAH&oo/G%nn.G g&   HHMMY c r@c*|jdddy)Nr(PASSESPsummary_passes_combinedrs r?rzTerminalReporter.summary_passes_s $$Xx=r@c*|jdddy)Nr,XPASSESXrMrs r?rz TerminalReporter.summary_xpassesbs $$Y 3?r@c|jjjdk7r|j|r|j |}|sy|j d||D]`}|j r7|j|}|j d|dd|j||j|jbyyy)NrxrrT)rjr) rrrtrr4rHsectionsr,_outrep_summary_handle_teardown_sectionsr)r= which_reports sep_title needed_optr=rrs r?rNz(TerminalReporter.summary_passes_combinedes ;;   % % -{{:&,0OOM,JsI."?C||"66s;sCt$G,,S1223::> ? ' .r@c|jd}|Dcgc]"}|jdk(r|j|k(r|$c}Scc}w)Nrr)r4rr)r=rr=rs r?_get_teardown_reportsz&TerminalReporter._get_teardown_reportsusI//"%" {{j(V]]f-D    s'AcR|j|D]}|j|yrR)rZprint_teardown_sections)r=rrs r?rUz*TerminalReporter._handle_teardown_sections}s*008 1F  ( ( 0 1r@c|jjj}|dk(ry|jD]X\}}|dk7r||vrd|vs|jj d||dddk(r|dd}|jj |Zy)Nrxrrrrr))rrr}rSrrFryr=rr}secnamer3s r?r\z(TerminalReporter.print_teardown_sectionsskk((44 $   #  ' GWe# 7(BW$ S'*23<4'%crlG g& 'r@cl|jjj}|jdd|y)Nr'FAILURESrs)rrrtsummary_failures_combined)r=rss r?rz!TerminalReporter.summary_failuress, ""** &&x5&Ir@c|jjj}|r |jjjnd}|j dd|y)Nrxr+ XFAILURESrb)rrr|rtrc)r=show_tbrss r?rz"TerminalReporter.summary_xfailuressE++$$--.5 ""**4 &&y+U&Kr@)rXc|dk7r|r|j|r|j|}|sy|jd||dk(r;|D]5}|j|}|j ||j |7y|D]T}|j |}|jd|dd|j ||j|jVyyy)NrxrryrTrlr) rr4rHr1rTrr,rUr) r=rVrWrsrXr=rryrs r?rcz*TerminalReporter.summary_failures_combineds D=Z!8,0OOM,JsI.F?&.#11#6,,S1-. 'C"66s;sCTE,,S166szzB C"9 r@c||jjjdk7r|jd}|sy|j dd|j dD]`}|j |}|jdk(rd|z}nd|jd|}|j d |d d |j|byy) Nrxr.rERRORSrzERROR collecting z ERROR at z of rTrh) rrrtr4rHrr,rrT)r=r=rrs r?rzTerminalReporter.summary_errorss ;;   % % -(,(@G NN3 )zz'* *..s388y(-3C%chhZtC59CsCT=$$S) * .r@cJ|j|j|jjj}|dk(ry|j D]S\}}|dk7r||vr|jj d||dddk(r|dd}|jj|Uy)Nrxrrrr))rrrrr}rSrFryr^s r?rTz TerminalReporter._outrep_summarys txx kk((44 $   #  # GWe# 7(B HHLLg &rs|t#!#2, HHMM' "  #r@c4|jdkry|jj}|j\}}g}|jdk\}|r|jj }|D]O\}}|jj |fi|} |rt| t|z z }|j| Qdj|} |di} dt|j} |jj | fi| } |rt| t| z z }| | z } |rE|jj d i| }|jdr|dd}t|z }| |z } |r|jd| fd i| y|j| fi| y) NrrrTz in zrrr)rrrbuild_summary_stats_linerrrrrrformat_session_durationrr&rHr)r=session_durationpartsr line_parts display_seprtextr with_markupr main_markuprduration_with_markupmarkup_for_end_seps r?r zTerminalReporter.summary_statss >>B  ..668";;=  nn) **I! +LD&)$((//$9&9KS-D 99   k *  + ii #!4( 12B2J2JKLM.txxxG;G  12S]B BI ## !0!C{!C !**95%7%<" /0 0I % %C  DNN3 Hy HK H DOOC /; /r@c  jsydfd }dfd }dfd }dfd dfd d fd }||t|d|t|d t|d d }g}jD]}|j|}|s|| |r.jd d dd|D]} j | yy)Ncjj|g}|syj}|D]G}tj|t}t ||j |di}|j|Iy)NT)rrr_color_for_type_color_for_type_default _get_line_with_reprcrash_messagerr)rstatr'rrrryr=s r? show_simplez8TerminalReporter.short_test_summary..show_simplesqZZ^^D"-F[[F #'++D2IJ7CE4= T"  #r@c jjdg}|D]}|j jtddi\}} j j |fi|}t j j|}|d|}|j}|r|dt|zz }|j|y)Nr+r-Tr - rr_get_verbose_word_with_markuprr|rr_get_node_id_with_markuprirLr) rr+r verbose_wordverbose_markup markup_wordrryrr=s r? show_xfailedz9TerminalReporter.short_test_summary..show_xfailedsjjnnY3G #/2/P/PKK/*"=t!D0, n.dhhoolMnM 1$((DKKM%ax0ECK//D T" #r@c jjdg}|D]}|j jtddi\}} j j |fi|}t j j|}|d|}|j}|r|dt|zz }|j|y)Nr,r-Trrr) rr,rrrrrryrr=s r? show_xpassedz9TerminalReporter.short_test_summary..show_xpassedsjjnnY3G #/2/P/PKK/*"=t!D0, n.dhhoolMnM 1$((DKKM%ax0ECK//D T" #r@c  jjdg}|rt j|ng}|sy|dj j t ddi\}} jj|fi|}d}|D]d\}}} } | j|r| t|d} | |j|d|d|d| d | I|j|d|d|d | fy) Nr)rr-T Skipped: rz] rr) rr _folded_skipsrrrr|rr startswithrr) rr)fskipsrrrr"numrrZrr=s r?show_skipped_foldedz@TerminalReporter.short_test_summary..show_skipped_foldeds+/::>>)R+HG?F]4>>7;BF+21:+S+S oj94@, (L.*$((//,I.IK F/5 N+VVV$$V,#CKM2F%LLK=3%r&6("VH!UVLLK=3%r&F8!LM  Nr@c\ jjdg}|D] }|jJt|jtsJ||jft |jdk(sJ||jf|j jtddi\}} jj|fi|}t j j|}|d|}|jd}|r|dt|zz }|j| y)Nr)rr-Trrnr)rrr/r=rvrrrr|rrrrLr) rr)rrrrrryrr=s r?show_skipped_unfoldedzBTerminalReporter.short_test_summary..show_skipped_unfolded1s+/::>>)R+HG #||///!#,,6Kcll8KK63<<(A-BS\\/BB-/2/P/PKK/*"=t!D0, n.dhhoolMnM 1$((DKKM%ax0aECK//D T" #r@c@jr |y|yrR)r)rr=rrs r? show_skippedz9TerminalReporter.short_test_summary..show_skippedDs#E*%e,r@r')rr(r.)rrQfrprrzshort test summary infoT)rsr)r list[str]rrLrPrQ)rrrPrQ)rnr rrHr) r=rrrrREPORTCHAR_ACTIONSrrreryrrs ` @@r?rz#TerminalReporter.short_test_summarys  # # # N$ #& -848473 I $$ D'++D1Fu    NN3 94N P &% & r@c|j|j |jr,|j|jsJ|jsJ|j|jfSrR)rrryrPrs r?rz TerminalReporter._get_main_color^sb    #t'8'8'@DDVDV  "## ##$$ $$!2!222r@c~|j}d|vsd|vrd}|Sd|vsd|vs|rd}|Sd|vs |jsd}|Sd}|S) Nr'r.rlr-r,rkr(rj)rry)r=unknown_type_seenrrs r?_determine_main_colorz&TerminalReporter._determine_main_colorest  u 5 0J 5 I$6:K!J   d&8&8 J"Jr@cg}|jD]$}|s|tvs||vs|j|&tt|z|_|j t ||_yrR)r KNOWN_TYPESrlistrrrNr)r= unknown_types found_types r?rPz TerminalReporter._set_main_colorqsf#% ** 5J[0Z}5T!((4 5!- =55d=6IJr@cx|jjdr|jS|jS)a Build the parts used in the last summary stats line. The summary stats line is the line shown at the end, "=== 12 passed, 2 errors in Xs===". This function builds a list of the "parts" that make up for the text in that line, in the example above it would be:: [ ("12 passed", {"green": True}), ("2 errors", {"red": True} ] That last dict for each line is a "markup dictionary", used by TerminalWriter to color output. The final color of the line is also determined by this function, and is the second element of the returned tuple. r)rr&_build_collect_only_summary_stats_line _build_normal_summary_stats_liners r?roz)TerminalReporter.build_summary_stats_linezs4( ;;  />>@ @88: :r@c|jj|g}|Dcgc]}t|dds|c}Scc}w)zRGet test/collection reports for the given status key, such as `passed` or `error`.rT)rrrD)r=keyr=rs r?rz(TerminalReporter._get_reports_to_displays6**..b)"Paga1H$&OPPPs;;c |j\}}g}|D]d}|j|}|st|}tj |t }|dd||k(i}|j dt||z|ff|s dt difg}||fS)NTr%d %sz no tests ran)rrrr|rr}r pluralize) r=r known_typesrrrr=rcrrs r?rz1TerminalReporter._build_normal_summary_stats_lines#'"6"6"8 K HC2237GG '++C1HIvu /BC g %(==vFG  H$'>&EFGEj  r@ct|jd}t|jd}|jdk(r dddifg}d}no|dk(r#d}dt|jd z}||difg}nG|j|k(}|r d}d |d }n&d}|j|z }|d |jd |d }||difg}|r td}|dt|dz|difgz }||fS)Nr*r.rzno tests collectedrkTrjz%d %s collectedtestzno tests collected (z deselected)rz tests collected (r)rrrrr|)r=r*r<rrrcollected_outputall_tests_were_deselectedrs r?rz7TerminalReporter._build_collect_only_summary_stats_lines855lCD T11':;    "*Xt,<=>E!J 1_ J09T=O=OQW3XX &T(:;@? ?-0?>A? ?  1 'JL"& CCC  C  C C4 * ##0Jj&X3 K;2Q ! 6!&! 6!r@rc|j|j}|jd^}}|r*|jdj |d}|dz|zS|S)NrTr)r%rrrr)twrrrpathrr parts_markups r?rrsZ  ' ' 3F<<%LD5 yy5!1y= d{\)) r@cX|jd}|dk7r|d|}d}t|jd}|t|z|kDry|t|z|kDr@|t|z}|d|}|t|z|kDr|dd}|t|z|kDr||z }|j|S)zFormat msg into format, ellipsizing it if doesn't fit in available_width. Returns None if even the ellipsis can't fit. r)rNz...r)findrrr)rrrrellipsis format_widths r?r|r|s ABw"1gHFMM"-.Lc(m#o5hsm#o53x=("?#Xc]*_<cr(CXc]*_< x == r@c|j||\}}|j|fi|}t|||}|d|}t|} t |j t r |j } n |j jj} ts|jjdk\r|jjsd| } n|j| z } td| | } | || z }|S#t$rY|SwxYw)z?Get summary line for a report, trying to add reprcrash message.rrnrz - {})rrrrr=r/rLr!rrrrdrkrr|r0) rrr word_markuprrr\rmry line_widthrrs r?r~r~s $'#D#D $ L. 299\ 4^ 4D #B 4DV1TF D$J cllC (,,C,,((00C Ov}}449--33u+C llZ7O!'3@C ? CKD K    K s AC44 DDc>i}|D]}|jJt|jtsJ||jft|jdk(sJ||jf|j\}}}t |t |}t |di}|jdk(rd|vr d|vr|d|f}n|||f}|j|gj|g} |jD]#\}} | jt| g|%| S)Nrkeywordsrskip pytestmark) r/r=rvrr"r rDrrNrrQ) rr)deventrrZrrrrHeventss r?rrs+ACA,~~)))%..%0I5%..2II05>>"a'@%)@@'!&YV 55*b1 JJ' !("H,06f/EC66*C S"$$U+',(68Fwwy+ V s6{)S)*+ Mr@rlrkrj)r'r.r-r(r/r0cT|dvr||fS|jdd}||dk7r|dzfS|fS)N)r.r-rr-rrBr)r)rcnouns r?rr=sD 00d{ << I .D  $* 44 44r@cg}|D]L\}}|jd|j}|jdr|dd}||vs<|j|N|S)Nrzpytest-) project_namerrr)rrHr_distrs r?rrJsgF" ##$Adll^4 ??9 %8D v  MM$   Mr@ch|dkr|ddStjt|}|dd|dS)zQFormat the given seconds in a human readable manner to show in the final summary.<.2frrzs (rp)datetime timedeltar)rdts r?rprpXsA|#a    G 5#c"Q''r@c"|dkr d|dzddS|dkr d|dzddS|dkr d|dzd dS|d kr d|d zdd S|d kr d|d zdd S|dkr d|d zd d S|dkrd|ddS|dkrd|dzdd|dzddSd|dzdd|dzdzddS)zQFormat the given seconds in a human readable manner to show in the test progress.gh㈵>ri@Bz.3fusg-C6?rgMbP?z.1fg{Gz?imsg?rBrriz.0fzm zh mr^rs r?rras!7W$S),,7W$S),,7W$S),,~7T>#&b))}7T>#&b)){7T>#&b))|73-q!!~7b=%R" S'9;; w$s#2w~"&Y6rs #$%#$   ',&(((!##,('&)&$ #  "=hoo"=J//(Vr?"2 $ , , 8O!O!O!d"2! !#!)7!FU!!H $,@  # 5 (D.*V&V&r@