grdZddlZddlmZejeZdZGddeZ GddeZ y) a Result Proxy ------------ The result proxy wraps the result instance given to each test. It performs two functions: enabling extended error/failure reporting and calling plugins. As each result event is fired, plugins are called with the same event; however, plugins are called with the nose.case.Test instance that wraps the actual test. So when a test fails and calls result.addFailure(self, err), the result proxy calls addFailure(self.test, err) for each plugin. This allows plugins to have a single stable interface for all test types, and also to manipulate the test object itself by setting the `test` attribute of the nose.case.Test that they receive. N)ConfigcFfd}fd}fd}t||||S)znCreate a property that proxies attribute ``proxied_attr`` through the local attribute ``local_attr``. c0tt|SN)getattrself local_attr proxied_attrs 9/opt/hc_python/lib/python3.12/site-packages/nose/proxy.pyfgetzproxied_attribute..fgetswtZ0,??c4tt||yr)setattrr)r valuer r s r fsetzproxied_attribute..fsetsj)<?rc2tt|yr)delattrrrs r fdelzproxied_attribute..fdel!sj)<8r)property)r r docr rrs`` r proxied_attributers%@@9 D$c **rceZdZdZddZdZy)ResultProxyFactoryzrFactory for result proxies. Generates a ResultProxy bound to each test and the result passed to the test. NcF| t}||_d|_d|_y)NF)rconfig_ResultProxyFactory__prepared_ResultProxyFactory__result)r rs r __init__zResultProxyFactory.__init__*s# >XF  rc|js7d|_|jjj|}| |x|_}|j |j}t |||jS)aReturn a ResultProxy for the current test. On first call, plugins are given a chance to replace the result used for the remaining tests. If a plugin returns a value from prepareTestResult, that object will be used as the result for all tests. T)r)rrpluginsprepareTestResultr ResultProxy)r resulttest plug_results r __call__zResultProxyFactory.__call__1sd"DO++--??GK&)44  == $]]F64 <XF ~~   rc,t|jSr)reprr$r s r __repr__zResultProxy.__repr__UsDKK  rct|dtsFt|dtr3t|djtfi|d}|d||df}|S)Nr) isinstance Exceptiontyper()r errrs r _prepareErrzResultProxy._prepareErrXs[#a&),CFD1I 99bmT2d8= >=< "rc|j||jj|jt |j dr&|j j|jyy)N afterTest)r@r!rBr%hasattrr$r r%s r rBzResultProxy.afterTestmsO $ tyy) 4;; , KK ! !$)) , -rc|j||jj|jt |j dr&|j j|jyy)N beforeTest)r@r!rFr%rCr$rDs r rFzResultProxy.beforeTestssO $  * 4;; - KK " "499 - .rc|j||j}|j|j|}|ry|j |j|}||}|j |j||j j |j|j||j js|jjrd|_ yyy)NT) r@r! handleErrorr% formatErroraddErrorr$r: wasSuccessfulr stopOnError shouldStopr r%r9r!plugin_handled formatteds r rJzResultProxy.addErrorys $,, ,,TYY<  '' 37  CC( TYY(8(8(=>{{((*t{{/F/F"DO0G*rc|j||j}|j|j|}|ryd|j_|j |j|}||}|j |j||jj |j|j||jjrd|_ yy)NFT) r@r! handleFailurer%passed formatFailure addFailurer$r:rrLrMrNs r rUzResultProxy.addFailures $,, ..tyy#>    ))$))S9  C499c* tyy$*:*:3*?@ ;; " ""DO #rc ddlm}|j||j}t |t s t |}|j |j||df|jj|j|y)Nr)SkipTest) nose.plugins.skiprWr@r!r6r7rJr%r$addSkip)r r%reasonrWr!s r rYzResultProxy.addSkipsc. $,,&),v&FXvt$<= DIIv.rc|j||jj|j|jj|jyr)r@r! addSuccessr%r$rDs r r\zResultProxy.addSuccesss< $  * tyy)rc|j||jj|j|jj|jyr)r@r! startTestr%r$rDs r r^zResultProxy.startTests< $ tyy) dii(rc8|jjyr)r$stopr1s r r`zResultProxy.stops rc|j||jj|j|jj|jyr)r@r!stopTestr%r$rDs r rbzResultProxy.stopTests< $ dii( TYY'rr$rMzShould the test run stop?errorszTests that raised an exceptionfailureszTests that failedtestsRunzNumber of tests runr)r(r)r*r+rr2r:r@rBrFrJrUrYr\r^r`rbrrMrcrdrer,rr r#r#Cs! >- . # # /* ) ( #8\$CEJ xCEF :!8:H :!:rksE"g! +==:y<&y