ó
    cÛ–iò_  ã                   óÜ  • S r SSKrSSKrSSKrSSKr " S S\R
                  5      rSS jrSS jrS r	\R                  r
\R                  r\" \
S	S5      c%   SSKr\R                  " 5       r
\R                  rS
rOS
rSrSrSr " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r\S:X  a  \" S\R8                  \R:                  S9  gg! \ a    Sr Nkf = f)zlRun a unittest testcase reporting results as Subunit.

$ python -m samba.subunit.run mylib.tests.test_suite
é    Nc                   óf   ^ • \ rS rSrSrS rSS jrS rU 4S jrU 4S jr	S r
S	 rS
 rS rSrU =r$ )ÚTestProtocolClienté!   aª  A TestResult which generates a subunit stream for a test run.

# Get a TestSuite or TestCase to run
suite = make_suite()
# Create a stream (any object with a 'write' method). This should accept
# bytes not strings: subunit is a byte orientated protocol.
stream = open('tests.log', 'wb')
# Create a subunit result object which will output to the stream
result = subunit.TestProtocolClient(stream)
# Optionally, to get timing data for performance analysis, wrap the
# serialiser with a timing decorator
result = subunit.test_results.AutoTimingTestResultDecorator(result)
# Run the test suite reporting to the subunit result object
suite.run(result)
# Close the stream.
stream.close()
c                 ó\   • [         R                  R                  U 5        Xl        / U l        g ©N)ÚunittestÚ
TestResultÚ__init__Ú_streamÚ	successes)ÚselfÚstreams     Ú3/usr/lib/python3/dist-packages/samba/subunit/run.pyr
   ÚTestProtocolClient.__init__4   s"   € Ü×Ñ×$Ñ$ TÔ*ØŒØˆ�ó    c                 óÀ  • U R                   R                  SU-  UR                  5       -   5        U(       a�  U R                   R                  S5        U HQ  nU R                   R                  U5        UR                  S5      (       a  M6  U R                   R                  S5        MS     U R                   R                  S5        U R                   R                  S5        g)z½Report an outcome of test test.

:param outcome: A string describing the outcome - used as the
    event name in the subunit stream.
:param errors: A list of strings describing the errors.
z%s: z [
Ú
Ú]N)r   ÚwriteÚidÚendswith)r   ÚoutcomeÚtestÚerrorsÚerrors        r   Ú_addOutcomeÚTestProtocolClient._addOutcome9   sž   € ð 	�‰×Ñ˜F WÑ,°·±³	Ñ9Ô:ÞØ�L‰L×Ñ˜vÔ&Û�Ø—‘×"Ñ" 5Ô)Ø—~‘~ d×+Ó+Ø—L‘L×&Ñ& tÖ,ñ  ð �L‰L×Ñ˜sÔ#Ø�‰×Ñ˜4Õ r   c                 ó:   • U R                   R                  U5        g)zReport a success in a test.N)r   Úappend©r   r   s     r   Ú
addSuccessÚTestProtocolClient.addSuccessJ   s   € à�‰×Ñ˜dÕ#r   c                 ó¶   >• [         TU ]  U5        U R                  R                  SUR	                  5       -   S-   5        U R                  R                  5         g)z%Mark a test as starting its test run.ztest: r   N)ÚsuperÚ	startTestr   r   r   Úflush©r   r   Ú	__class__s     €r   r%   ÚTestProtocolClient.startTestN   sB   ø€ ä‰Ñ˜$ÔØ�‰×Ñ˜8 d§g¡g£iÑ/°$Ñ6Ô7Ø�‰×ÑÕr   c                 óF   >• [         TU ]  U5        U R                  U5        g)z,Mark a test as having finished its test run.N)r$   ÚstopTestÚwriteOutcomer'   s     €r   r+   ÚTestProtocolClient.stopTestT   s   ø€ ä‰Ñ˜ÔØ×Ñ˜$Õr   c                 óŠ  • U R                  XR                  5      u  o l        U R                  XR                  5      u  o0l        U R                  XR                  5      u  o@l        U R                  XR                  5      u  oPl        U R                  XR                  5      u  o`l        U R                  XR                  5      u  opl        U(       a  SnO4U(       a  SnO*U(       a  SnO U(       a  SnOU(       a  SnOU(       a  SnOSnU(       a  U R                  X�X#-   U-   U-   S9  U R                  R                  5         g)	z)Output the overall outcome for test test.r   ÚfailureÚskipÚ	uxsuccessÚxfailÚ
successfulN)r   )Ú_filterErrorsr   ÚfailuresÚexpectedFailuresÚskippedÚ_filterSuccessesr   ÚunexpectedSuccessesr   r   r&   )	r   r   ÚerrÚfailr2   r0   Úsuccessr1   r   s	            r   r,   ÚTestProtocolClient.writeOutcomeY   s  € à.2×.@Ñ.@ÀÏ+É+Ó.VÑˆ”;Ø.2×.@Ñ.@ÀÏ-É-Ó.XÑ ˆ”=Ø.2×.@Ñ.@À×J_ÑJ_Ó.`Ñ(ˆÔ(Ø.2×.@Ñ.@ÀÏ,É,Ó.WÑˆ”<Ø.2×.CÑ.CÀDÏ.É.Ó.YÑ!ˆ”>Ø.2×.CÑ.CÀD×JbÑJbÓ.cÑ+ˆ	Ô+æØ‰GÞØ‰GÞØ‰GÞØ!‰GÞØ‰GÞØ"‰GàˆGæØ×Ñ˜W°3±8¸D±=ÀÑ3FÐÑGà�‰×ÑÕr   c                 ó€   • / n/ nU H2  nUS   UL a  UR                  US   5        M!  UR                  U5        M4     X44$ )a.  Filter a list of errors by test test.

:param test: The test to filter by.
:param errors: A list of <test, error> pairs to filter.

:return: A pair whose first element is a list of strings containing
    errors that apply to test test, and whose second element is a list
    of the remaining elements.
r   é   ©r   )r   r   r   ÚfilteredÚ
unfilteredr   s         r   r4   Ú TestProtocolClient._filterErrorsv   sM   € ð ˆØˆ
ãˆEØ�Q‰x˜4ÒØ—‘  a¡Ö)à×!Ñ! %Ö(ñ	 ð Ð%Ð%r   c                 óT   • Sn/ nU H  nXQL a  SnM  UR                  U5        M     X44$ )a2  Filter a list of successes by test test.

:param test: The test to filter by.
:param successes: A list of tests to filter.

:return: A tuple whose first element is a boolean stating whether test
    test was found in the list of successes, and whose second element is
    a list of the remaining elements.
FTr@   )r   r   r   rA   rB   r<   s         r   r8   Ú#TestProtocolClient._filterSuccesses‹   s;   € ð ˆØˆ
ã ˆGØŠØ’à×!Ñ! 'Ö*ñ	 !ð Ð%Ð%r   c           
      ó,  • UR                  [        R                  R                  5      nU R                  R                  SUR                  UR                  UR                  UR                  UR                  UR                  UR                  4-  5        g)zPInform the client of the time.

":param a_datetime: A datetime.datetime object.
z*time: %04d-%02d-%02d %02d:%02d:%02d.%06dZ
N)Ú
astimezoneÚdatetimeÚtimezoneÚutcr   r   ÚyearÚmonthÚdayÚhourÚminuteÚsecondÚmicrosecond)r   Ú
a_datetimeÚtimes      r   rS   ÚTestProtocolClient.time    sn   € ð
 ×$Ñ$¤X×%6Ñ%6×%:Ñ%:Ó;ˆØ�‰×ÑÐHØ�I‰I�t—z‘z 4§8¡8¨T¯Y©Y¸¿¹Ø�K‰K˜×)Ñ)ðL+ñ +õ 	,r   )r   r   r6   r5   r7   r   r9   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r
   r   r!   r%   r+   r,   r4   r8   rS   Ú__static_attributes__Ú__classcell__©r(   s   @r   r   r   !   s:   ø† ñò$ô
!ò"$õõ ò
ò:&ò*&÷*,ð ,r   r   Fc                 óˆ  •  [        U 5      n[        U 5      [        R
                  4;   d  U(       a'  / nU H  nUR                  [        U5      5        M     U$ S n[        U 5      nU H  nUR                  5       n  O   [        U SS 5      b  U R                  5         XP4/$ ! [         a    U R                  5       U 4/s $ f = f)NÚ
sort_tests)ÚiterÚ	TypeErrorr   Útyper   Ú	TestSuiteÚextendÚ_flatten_testsÚiterate_testsÚgetattrr^   )Úsuite_or_caseÚunpack_outerÚtestsÚresultr   Úsuite_ids         r   rd   rd   «   sÍ   € ð5Ü�]Ó#ˆô 	ˆ]Ó¤× 2Ñ 2Ð4Ó4ÞàˆÛˆDà�M‰Mœ.¨Ó.Ö/ñ ð ˆð ˆÜ˜mÓ,ˆÛˆDØ—w‘w“yˆHÙñ ô �= ,°Ó5ÑAØ×$Ñ$Ô&ØÐ)Ð*Ð*øô+ ó 5à×!Ñ!Ó# ]Ð3Ð4Ò4ð5ús   ‚B! Â!CÃ Cc                 ó–   • [        XS9nUR                  5         [        R                  " U VVs/ s H  u  p4UPM	     snn5      $ s  snnf )z;Sort suite_or_case while preserving non-vanilla TestSuites.)rh   )rd   Úsortr   rb   )rg   rh   ri   Úsort_keyr   s        r   Úsorted_testsro   Æ   s;   € ä˜=ÑD€EØ	‡J�J„LÜ×Ò¹EÔBºEÑ(8¨›t¹EÒBÓCÐCùÓBs   ¯A
c              #   óŠ   #   •  [        U 5      nU H  n[        U5       H  nUv •  M	     M     g! [         a    U v •   gf = f7f)z>Iterate through all of the test cases in 'test_suite_or_case'.N)r_   re   r`   )Útest_suite_or_caseÚsuiter   Úsubtests       r   re   re   Í   sK   é € ðÜÐ'Ó(ˆó ˆDÜ(¨Ö.�Ø”ó /ò øô ó !Ø Ô ð!üs#   ‚A„/ � A¯A ½A¿A Á AÚdiscoverTz7  -c, --catch      Catch control-C and display results
z=  -b, --buffer     Buffer stdout and stderr during test runs
a/  Usage: %(progName)s [options] [tests]

Options:
  -h, --help       Show this message
  -v, --verbose    Verbose output
  -q, --quiet      Minimal output
  -l, --list       List tests rather than executing them.
  --load-list      Specifies a file containing test ids, only tests matching
                   those ids are executed.
%(catchbreak)s%(buffer)s
Examples:
  %(progName)s test_module               - run tests from test_module
  %(progName)s module.TestClass          - run tests from module.TestClass
  %(progName)s module.Class.test_method  - run specified test method

All options must come before [tests].  [tests] can be a list of any number of
test modules, classes and test methods.

Alternative Usage: %(progName)s discover [options]

Options:
  -v, --verbose    Verbose output
s%(catchbreak)s%(buffer)s  -s directory     Directory to start discovery ('.' default)
  -p pattern       Pattern to match test files ('test*.py' default)
  -t directory     Top level directory of project (default to
                   start directory)
  -l, --list       List tests rather than executing them.
  --load-list      Specifies a file containing test ids, only tests matching
                   those ids are executed.

For test discovery all test modules must be importable from the top
level directory of the project.
c                   óœ   • \ rS rSrSrS rS rS rS rS r	SS	 jr
SS
 jrS rSS jrSS jrS rS r\S 5       rS r\S 5       rS rSrg)ÚTestResultDecoratori(  züGeneral pass-through decorator.

This provides a base that other TestResults can inherit from to
gain basic forwarding functionality. It also takes care of
handling the case where the target doesn't support newer methods
or features by degrading them.
c                 ó   • Xl         g)z5Create a TestResultDecorator forwarding to decorated.N©Ú	decorated)r   ry   s     r   r
   ÚTestResultDecorator.__init__1  s	   € ð #�r   c                 ó8   • U R                   R                  U5      $ r   )ry   r%   r    s     r   r%   ÚTestResultDecorator.startTest6  s   € Ø�~‰~×'Ñ'¨Ó-Ð-r   c                 ó6   • U R                   R                  5       $ r   )ry   ÚstartTestRun©r   s    r   r~   Ú TestResultDecorator.startTestRun9  s   € Ø�~‰~×*Ñ*Ó,Ð,r   c                 ó8   • U R                   R                  U5      $ r   )ry   r+   r    s     r   r+   ÚTestResultDecorator.stopTest<  s   € Ø�~‰~×&Ñ& tÓ,Ð,r   c                 ó6   • U R                   R                  5       $ r   )ry   ÚstopTestRunr   s    r   r„   ÚTestResultDecorator.stopTestRun?  s   € Ø�~‰~×)Ñ)Ó+Ð+r   Nc                 ó8   • U R                   R                  X5      $ r   )ry   ÚaddError©r   r   r:   s      r   r‡   ÚTestResultDecorator.addErrorB  s   € Ø�~‰~×&Ñ& tÓ1Ð1r   c                 ó8   • U R                   R                  X5      $ r   )ry   Ú
addFailurerˆ   s      r   r‹   ÚTestResultDecorator.addFailureE  s   € Ø�~‰~×(Ñ(¨Ó3Ð3r   c                 ó8   • U R                   R                  U5      $ r   )ry   r!   r    s     r   r!   ÚTestResultDecorator.addSuccessH  s   € Ø�~‰~×(Ñ(¨Ó.Ð.r   c                 ó8   • U R                   R                  X5      $ r   )ry   ÚaddSkip©r   r   Úreasons      r   r�   ÚTestResultDecorator.addSkipK  s   € Ø�~‰~×%Ñ% dÓ3Ð3r   c                 ó8   • U R                   R                  X5      $ r   )ry   ÚaddExpectedFailurerˆ   s      r   r•   Ú&TestResultDecorator.addExpectedFailureN  s   € Ø�~‰~×0Ñ0°Ó;Ð;r   c                 ó8   • U R                   R                  U5      $ r   )ry   ÚaddUnexpectedSuccessr    s     r   r˜   Ú(TestResultDecorator.addUnexpectedSuccessQ  s   € Ø�~‰~×2Ñ2°4Ó8Ð8r   c                 ó6   • U R                   R                  5       $ r   )ry   ÚwasSuccessfulr   s    r   r›   Ú!TestResultDecorator.wasSuccessfulT  s   € Ø�~‰~×+Ñ+Ó-Ð-r   c                 ó.   • U R                   R                  $ r   ©ry   Ú
shouldStopr   s    r   rŸ   ÚTestResultDecorator.shouldStopW  ó   € à�~‰~×(Ñ(Ð(r   c                 ó6   • U R                   R                  5       $ r   )ry   Ústopr   s    r   r£   ÚTestResultDecorator.stop[  s   € Ø�~‰~×"Ñ"Ó$Ð$r   c                 ó.   • U R                   R                  $ r   )ry   ÚtestsRunr   s    r   r¦   ÚTestResultDecorator.testsRun^  s   € à�~‰~×&Ñ&Ð&r   c                 ó8   • U R                   R                  U5      $ r   )ry   rS   ©r   rR   s     r   rS   ÚTestResultDecorator.timeb  s   € Ø�~‰~×"Ñ" :Ó.Ð.r   rx   r   )rU   rV   rW   rX   rY   r
   r%   r~   r+   r„   r‡   r‹   r!   r�   r•   r˜   r›   ÚpropertyrŸ   r£   r¦   rS   rZ   © r   r   rv   rv   (  su   † ñò#ò
.ò-ò-ò,ô2ô4ò/ô4ô<ò9ò.ð ñ)ó ð)ò%ð ñ'ó ð'õ/r   rv   c                   óš   ^ • \ rS rSrSrU 4S jrS rS rS rS r	SS jr
SS	 jrS
 rSS jrSS jrS rS r\S 5       rS rS rSrU =r$ )ÚHookedTestResultDecoratorif  z/A TestResult which calls a hook on every event.c                 óZ   >• [        5       U l         U R                   R                  U5        g r   )r$   r
   ©r   ry   r(   s     €r   r
   Ú"HookedTestResultDecorator.__init__i  s   ø€ Ü“WˆŒ
Ø�
‰
×Ñ˜IÕ&r   c                 óX   • U R                  5         U R                  R                  U5      $ r   )Ú_before_eventr$   r%   r    s     r   r%   Ú#HookedTestResultDecorator.startTestm  s#   € Ø×ÑÔØ�z‰z×#Ñ# DÓ)Ð)r   c                 óV   • U R                  5         U R                  R                  5       $ r   )r³   r$   r~   r   s    r   r~   Ú&HookedTestResultDecorator.startTestRunq  s!   € Ø×ÑÔØ�z‰z×&Ñ&Ó(Ð(r   c                 óX   • U R                  5         U R                  R                  U5      $ r   )r³   r$   r+   r    s     r   r+   Ú"HookedTestResultDecorator.stopTestu  s#   € Ø×ÑÔØ�z‰z×"Ñ" 4Ó(Ð(r   c                 óV   • U R                  5         U R                  R                  5       $ r   )r³   r$   r„   r   s    r   r„   Ú%HookedTestResultDecorator.stopTestRuny  s!   € Ø×ÑÔØ�z‰z×%Ñ%Ó'Ð'r   c                 óX   • U R                  5         U R                  R                  X5      $ r   )r³   r$   r‡   rˆ   s      r   r‡   Ú"HookedTestResultDecorator.addError}  s#   € Ø×ÑÔØ�z‰z×"Ñ" 4Ó-Ð-r   c                 óX   • U R                  5         U R                  R                  X5      $ r   )r³   r$   r‹   rˆ   s      r   r‹   Ú$HookedTestResultDecorator.addFailure�  s#   € Ø×ÑÔØ�z‰z×$Ñ$ TÓ/Ð/r   c                 óX   • U R                  5         U R                  R                  U5      $ r   )r³   r$   r!   r    s     r   r!   Ú$HookedTestResultDecorator.addSuccess…  s#   € Ø×ÑÔØ�z‰z×$Ñ$ TÓ*Ð*r   c                 óX   • U R                  5         U R                  R                  X5      $ r   )r³   r$   r�   r‘   s      r   r�   Ú!HookedTestResultDecorator.addSkip‰  s#   € Ø×ÑÔØ�z‰z×!Ñ! $Ó/Ð/r   c                 óX   • U R                  5         U R                  R                  X5      $ r   )r³   r$   r•   rˆ   s      r   r•   Ú,HookedTestResultDecorator.addExpectedFailure�  s#   € Ø×ÑÔØ�z‰z×,Ñ,¨TÓ7Ð7r   c                 óX   • U R                  5         U R                  R                  U5      $ r   )r³   r$   r˜   r    s     r   r˜   Ú.HookedTestResultDecorator.addUnexpectedSuccess‘  s#   € Ø×ÑÔØ�z‰z×.Ñ.¨tÓ4Ð4r   c                 óV   • U R                  5         U R                  R                  5       $ r   )r³   r$   r›   r   s    r   r›   Ú'HookedTestResultDecorator.wasSuccessful•  s!   € Ø×ÑÔØ�z‰z×'Ñ'Ó)Ð)r   c                 óN   • U R                  5         U R                  R                  $ r   )r³   r$   rŸ   r   s    r   rŸ   Ú$HookedTestResultDecorator.shouldStop™  s   € à×ÑÔØ�z‰z×$Ñ$Ð$r   c                 óV   • U R                  5         U R                  R                  5       $ r   )r³   r$   r£   r   s    r   r£   ÚHookedTestResultDecorator.stopž  s   € Ø×ÑÔØ�z‰z�‰Ó Ð r   c                 óX   • U R                  5         U R                  R                  U5      $ r   )r³   r$   rS   r©   s     r   rS   ÚHookedTestResultDecorator.time¢  s!   € Ø×ÑÔØ�z‰z�‰˜zÓ*Ð*r   )r$   r   )rU   rV   rW   rX   rY   r
   r%   r~   r+   r„   r‡   r‹   r!   r�   r•   r˜   r›   r«   rŸ   r£   rS   rZ   r[   r\   s   @r   r®   r®   f  se   ø† Ù9õ'ò*ò)ò)ò(ô.ô0ò+ô0ô8ò5ò*ð ñ%ó ð%ò!÷+ð +r   r®   c                   óH   ^ • \ rS rSrSrU 4S jrS r\S 5       rS r	Sr
U =r$ )ÚAutoTimingTestResultDecoratori§  zþDecorate a TestResult to add time events to a test run.

By default this will cause a time event before every test event,
but if explicit time data is being provided by the test run, then
this decorator will turn itself off to prevent causing confusion.
c                 ó2   >• S U l         [        TU ]	  U5        g r   )Ú_timer$   r
   r°   s     €r   r
   Ú&AutoTimingTestResultDecorator.__init__¯  s   ø€ ØˆŒ
Ü‰Ñ˜Õ#r   c                 óÄ   • U R                   nUb  g [        R                  R                  [        R                  R                  S9nU R
                  R                  U5        g )N)Útz)rÒ   rH   ÚnowrI   rJ   ry   rS   )r   rS   s     r   r³   Ú+AutoTimingTestResultDecorator._before_event³  sK   € Ø�z‰zˆØÑØÜ× Ñ ×$Ñ$¬×(9Ñ(9×(=Ñ(=Ð$Ð>ˆØ�‰×Ñ˜DÕ!r   c                 ó.   • U R                   R                  $ r   rž   r   s    r   rŸ   Ú(AutoTimingTestResultDecorator.shouldStopº  r¡   r   c                 óD   • Xl         U R                  R                  U5      $ )a4  Provide a timestamp for the current test activity.

:param a_datetime: If None, automatically add timestamps before every
    event (this is the default behaviour if time() is not called at
    all).  If not None, pass the provided time onto the decorated
    result object and disable automatic timestamps.
)rÒ   ry   rS   r©   s     r   rS   Ú"AutoTimingTestResultDecorator.time¾  s   € ð  Œ
Ø�~‰~×"Ñ" :Ó.Ð.r   )rÒ   )rU   rV   rW   rX   rY   r
   r³   r«   rŸ   rS   rZ   r[   r\   s   @r   rÐ   rÐ   §  s0   ø† ñõ$ò"ð ñ)ó ð)÷	/ð 	/r   rÐ   c                   ó$   • \ rS rSrSS jrS rSrg)ÚSubunitTestRunneriÊ  Nc                 ó@   • U=(       d    [         R                  U l        g)zPCreate a SubunitTestRunner.

:param verbosity: Ignored.
:param buffer: Ignored.
N)ÚsysÚstdoutr   )r   Ú	verbosityÚbufferr   s       r   r
   ÚSubunitTestRunner.__init__Ì  s   € ð ×*¤§
¡
ˆ�r   c                 óV   • [        U R                  5      n[        U5      nU" U5        U$ )z&Run the given test case or test suite.)r   r   rÐ   )r   r   rj   s      r   ÚrunÚSubunitTestRunner.runÔ  s&   € ä# D§K¡KÓ0ˆÜ.¨vÓ6ˆÙˆVŒØˆr   )r   )NNN)rU   rV   rW   rX   r
   rå   rZ   r¬   r   r   rÝ   rÝ   Ê  s   † ô+õr   rÝ   c            
       ón   • \ rS rSrSr\rS=r=rr	\ SSS\
SSSSS4
S jrS rS r\4S	 jrS
 rSS jrSrg)ÚTestProgramiÜ  ztA command-line program that runs a set of tests; this is primarily
for making test modules conveniently executable.
NTr?   c                 ó`  • U[         :X  a  S U l        Ob[        U[        5      (       aG  [	        U5      U l        UR                  S5      SS   H  n[        U R                  U5      U l        M      OXl        Uc  [        R                  nU
c  [        R                  n
Uc
  [        5       nX`l        X€l        Xpl        X�l        X l        SU l        S U l        X@l        XPl        US   nUR)                  S[*        R,                  R.                  -  5      (       a2  UR                  [*        R,                  R.                  5      nSUS   -  nO"[*        R,                  R1                  US   5      nXÀl        U R5                  U5        U R"                  (       a¨  [7        U R"                  S5      n UR9                  5       nUR;                  5         [=        S	 U 5       5      n[>        R@                  " 5       n[C        U RD                  5       H*  nURG                  5       U;   d  M  URI                  U5        M,     UU l"        U R                   (       d  U RK                  5         g [C        U RD                  5       H%  nU
RM                  S
URG                  5       -  5        M'     g ! UR;                  5         f = f)NÚ.r?   Fr   z%srun.pyz%s.runéþÿÿÿÚrbc              3   ó^   #   • U  H#  oR                  5       R                  S 5      v •  M%     g7f)zutf-8N)ÚstripÚdecode)Ú.0Úlines     r   Ú	<genexpr>Ú'TestProgram.__init__.<locals>.<genexpr>  s"   é € ÐJÂE¸DŸ:™:›<×.Ñ.¨w×7Ð7ÂEùs   ‚+-z%s
)'rU   ÚmoduleÚ
isinstanceÚstrÚ
__import__Úsplitrf   rß   Úargvrà   rÝ   ÚexitÚ
catchbreakrá   râ   ÚdefaultTestÚ	listtestsÚ	load_listÚ
testRunnerÚ
testLoaderr   ÚosÚpathÚsepÚbasenameÚprogNameÚ	parseArgsÚopenÚ	readlinesÚcloseÚsetr   rb   re   r   r   ÚaddTestÚrunTestsr   )r   rô   rü   rù   rÿ   r   rú   rá   rû   râ   rà   Úpartr  ÚelementsÚsourceÚlinesÚtest_idsrA   r   s                      r   r
   ÚTestProgram.__init__å  s  € ð ”XÓØˆD�KÜ˜¤×$Ñ$Ü$ VÓ,ˆDŒKØŸ™ SÓ)¨!¨"Ó-�Ü% d§k¡k°4Ó8�–ò .ð !ŒKØ‰<Ü—8‘8ˆDØ‰>Ü—Z‘ZˆFØÑÜ*Ó,ˆJàŒ	Ø$ŒØ"ŒØŒØ&ÔØˆŒØˆŒØ$ŒØ$ŒØ˜‘7ˆØ×Ñ˜Z¬"¯'©'¯+©+Ñ5×6Ñ6Ø—~‘~¤b§g¡g§k¡kÓ2ˆHØ (¨2¡,Ñ.‰Hä—w‘w×'Ñ'¨¨Q©Ó0ˆHØ ŒØ�‰�tÔØ�>�>ô
 ˜$Ÿ.™.¨$Ó/ˆFðØ×(Ñ(Ó*�à—‘”ÜÑJÁEÓJÓJˆHÜ×)Ò)Ó+ˆHÜ% d§i¡iÖ0�Ø—7‘7“9 Õ(Ø×$Ñ$ TÖ*ñ 1ð !ˆDŒIØ�~�~Ø�M‰M�Oä% d§i¡iÖ0�Ø—‘˜V d§g¡g£iÑ/Ö0ò 1øð —‘•ús   Æ)J ÊJ-c                 ó  • [        U5      S:”  a,  US   R                  5       S:X  a  U R                  USS  5        g SS Kn/ SQn UR                  USS  SU5      u  pEU H„  u  pgUS;   a  U R	                  5         US;   a  SU l        US	;   a  SU l        US
;   a  U R                  c  SU l        US;   a  U R                  c  SU l        US;   a  SU l        US:X  d  M~  Xpl	        M†     [        U5      S:X  a  U R                  c  S U l        O([        U5      S:”  a  XPl        OU R                  4U l        U R                  5         g ! UR                   a*    U R	                  [        R                  " 5       S   5         g f = f)Nr?   rt   é   r   )ÚhelpÚverboseÚquietÚcatchrâ   Úlistz
load-list=ÚhHvqfcbl)z-hz-Hz--help)z-qz--quiet)ú-vú	--verbose)ú-cú--catchT)ú-bú--buffer)ú-lú--listú--load-list)ÚlenÚlowerÚ_do_discoveryÚgetoptÚ	usageExitrá   rû   râ   rý   rþ   rü   Ú	testNamesÚcreateTestsr   rß   Úexc_info)r   rù   r'  Ú	long_optsÚoptionsÚargsÚoptÚvalues           r   r  ÚTestProgram.parseArgs  sc  € Üˆt‹9�q‹=˜T !™WŸ]™]›_°
Ó:Ø×Ñ˜t A B˜xÔ(Øãò"ˆ	ð	.Ø"ŸM™M¨$¨q¨r¨(°JÀ	ÓJ‰MˆGÛ%‘
�ØÐ.Ó.Ø—N‘NÔ$ØÐ*Ó*Ø%&�D”NØÐ,Ó,Ø%&�D”NØÐ*Ó*Ø—‘Ñ.Ø*.˜œàÐ+Ó+Ø—{‘{Ñ*Ø&*˜œàÐ*Ó*Ø%)�D”NØ˜-Õ'Ø%*–Nñ% &ô& �4‹y˜A‹~ $×"2Ñ"2Ñ":à!%�•Ü�T“˜Q“Ø!%•à"&×"2Ñ"2Ð!4�”Ø×ÑÕøØ�|‰|ó 	.Ø�N‰Nœ3Ÿ<š<›>¨!Ñ,Ö-ð	.ús   ÁBE ÃA&E Å7E>Å=E>c                 óÞ   • U R                   c+  U R                  R                  U R                  5      U l        g U R                  R                  U R                   U R                  5      U l        g r   )r)  r   ÚloadTestsFromModulerô   r   ÚloadTestsFromNamesr   s    r   r*  ÚTestProgram.createTestsG  sJ   € Ø�>‰>Ñ!ØŸ™×;Ñ;¸D¿K¹KÓHˆD�IàŸ™×:Ñ:¸4¿>¹>Ø;?¿;¹;óHˆD�Ir   c           	      ó@  • [         (       d  [        S5      eSU R                  -  U l        SS KnUR	                  5       nU R                  Ul        UR                  SSSSSS	S
9  U R                  SLa  UR                  SSSSSS	S
9  U R                  SLa  UR                  SSSSSS	S
9  UR                  SSSSSS9  UR                  SSSSSS9  UR                  SSS S S!S9  UR                  S"S#S$SS	S%S&9  UR                  S'S(S S)S9  UR                  U5      u  pV[        U5      S*:”  a  U R                  5         [        S+U5       H  u  px[        XWU5        M     U R                  c  UR                  U l        U R                  c  UR                  U l        UR                  U l        UR                  U l        UR                   (       a  S,U l        UR$                  n	UR&                  n
UR(                  nU" 5       nUR+                  XšU5      n[-        U5      U l        g )-NzYUnable to use discovery, must use python 2.7 or greater, or install the discover package.z%s discoverr   r  r  r  FzVerbose outputÚ
store_true)ÚdestÚdefaultr  Úactionr  r  rû   z'Catch ctrl-C and display results so farr  r   râ   z%Buffer stdout and stderr during testsz-sz--start-directoryÚstartrê   z*Directory to start discovery ('.' default))r8  r9  r  z-pz	--patternÚpatternztest*.pyz+Pattern to match tests ('test*.py' default)z-tz--top-level-directoryÚtopz<Top level directory of project (defaults to start directory)r!  r"  rý   z$List tests rather than running them.)r8  r9  r:  r  r#  rþ   z2Specify a filename containing the test ids to use.é   )r;  r<  r=  r  )Úhave_discoverÚAssertionErrorr  ÚoptparseÚOptionParserÚprogÚ
add_optionrû   râ   Ú
parse_argsr$  r(  ÚzipÚsetattrrý   rþ   r  rá   r;  r<  r=  rt   ro   r   )r   rù   ÚLoaderrA  Úparserr-  r.  Únamer0  Ú	start_dirr<  Útop_level_dirÚloaderÚloadeds                 r   r&  ÚTestProgram._do_discoveryN  sC  € çŠ}Ü ð "Có Dð Dà%¨¯©Ñ5ˆŒÛØ×&Ñ&Ó(ˆØ—m‘mˆŒØ×Ñ˜$ °)ÀUØ/¸ð 	ñ 	Fà�?‰? %Ò'Ø×Ñ˜d I°LÈ%Ø#LØ%1ð ñ 3ð �;‰;˜eÒ#Ø×Ñ˜d J°XÀuØ#JØ%1ð ñ 3ð 	×Ñ˜$Ð 3¸'È3ØKð 	ñ 	Mà×Ñ˜$ °)ÀZØLð 	ñ 	Nà×Ñ˜$Ð 7¸eÈTØ]ð 	ñ 	_à×Ñ˜$ ¨{ÀEÐR^ØEð 	ñ 	Gà×Ñ˜-¨kÀ4ØSð 	ñ 	Uð ×)Ñ)¨$Ó/‰ˆÜˆt‹9�q‹=Ø�N‰NÔäÐ:¸DÖA‰KˆDÜ�G 5Ö)ñ Bð
 �?‰?Ñ"Ø%×0Ñ0ˆDŒOØ�;‰;ÑØ!Ÿ.™.ˆDŒKØ ×*Ñ*ˆŒØ ×*Ñ*ˆŒà�?�?ØˆDŒNà—M‘Mˆ	Ø—/‘/ˆØŸ™ˆá“ˆð —‘ °]ÓCˆÜ  Ó(ˆ�	r   c                 óR  • U R                   (       a'  [        [        SS 5      b  [        R                  " 5         U R                  R                  U R                  5      U l        U R                  (       a4  [        R                  " U R                  R                  5       (       + 5        g g )NÚinstallHandler)rû   rf   r   rQ  rÿ   rå   r   rj   rú   rß   r›   r   s    r   r  ÚTestProgram.runTests�  sg   € Ø�O�OÜœÐ"2°DÓ9ÑEÜ×#Ò#Ô%Ø—o‘o×)Ñ)¨$¯)©)Ó4ˆŒØ�9�9Ü�HŠH˜Ÿ™×2Ñ2Ó4Ô4Õ5ð r   c                 ó�  • U(       a  [        U5        U R                  SSS.nU R                  SLa	  [        US'   U R                  SLa	  [
        US'   U R                  U-  nUR                  S5      nUR                  SS5        UR                  S	S5        [        SR                  U5      5        [        R                  " S5        g )
NÚ )r  rû   râ   Frû   râ   r   r  z)Run a test suite with a subunit reporter.r>  )Úprintr  rû   Ú
CATCHBREAKrâ   ÚBUFFEROUTPUTÚUSAGErø   ÚinsertÚjoinrß   rú   )r   ÚmsgÚusageÚ
usage_textÚusage_liness        r   r(  ÚTestProgram.usageExit˜  s¥   € ÞÜ�3ŒKØ!Ÿ]™]¸"Øñˆà�?‰? %Ò'Ü",ˆE�,ÑØ�;‰;˜eÒ#Ü*ˆE�(‰OØ—Z‘Z %Ñ'ˆ
Ø ×&Ñ& tÓ,ˆØ×Ñ˜1ÐIÔJØ×Ñ˜1˜bÔ!Üˆd�i‰i˜Ó$Ô%Ü�Š��r   )râ   rû   rü   rú   rý   rþ   rô   r  rj   r   r   r)  rÿ   rá   r   )rU   rV   rW   rX   rY   ÚUSAGE_AS_MAINrX  rû   râ   r  ÚdefaultTestLoaderr
   r  r*  ÚdefaultTestLoaderClsr&  r  r(  rZ   r¬   r   r   rè   rè   Ü  s`   † ñð €Eð &*Ð)€JÐ)�˜(à&°D¸tØ#Ð0AØ¨°tØ¨ô81òt&.òPHð *>ô @)òD6÷r   rè   Ú__main__)rô   rù   rà   )F)rY   rH   r  rß   r   r	   r   rd   ro   re   ra  Ú
TestLoaderrb  rf   rt   ÚDiscoveringTestLoaderr?  ÚImportErrorrV  rW  r`  Úobjectrv   r®   rÐ   rÝ   rè   rU   rù   rà   r¬   r   r   Ú<module>rh     s)  ðñ,ó
 Û 	Û 
Û ôG,˜×,Ñ,ô G,ôT+ô6Dò	ð ×.Ñ.Ð Ø×*Ñ*Ð á
Ð˜j¨$Ó/Ñ7ðÛØ$×:Ò:Ó<ÐØ'×=Ñ=ÐØ‰ð €Mð4 J€
ØO€ð!€ôL;/˜&ô ;/ô|>+Ð 3ô >+ôB /Ð$=ô  /ôF˜ô ô$J�&ô JðZ ˆzÓÙ�t #§(¡(°3·:±:Ó>ð øðO ó ØŠðús   Á#C  Ã C+Ã*C+