a
    /§»a·b  ã                   @   sÀ  U d Z ddlZddlZddlZddlZddlZddlZddlZddlm	Z	 ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ dd	l
mZ dd
l
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddlZddlZddlmZ ddlmZ ddlmZ ddlm Z  ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 e�r¬ddl5Z5dZ6d Z7d!Z8d"Z9d#Z:e6e7e8e9e:fZ;da<da=eed$  e>d%< e(dd&œd'd(„Z?dd)œd*d+„Z@ejAjBe,eed,  d-œd.d/„ZCejAjBeDd0œd1d2„ZEe&ejAjBeDd3œd4d5„ZFG d6d7„ d7e ƒZGG d8d9„ d9eHƒZIed: d)œd;d<„ZJdked$ eeD eKeDd:d>œd?d@„ZLG dAdB„ dBejMƒZNeeOeKf d)œdCdD„ZPdEdF„ ZQdGdH„ ZRG dIdJ„ dJejSƒZTdKddLœdMdN„ZUeVeDdOœdPdQ„ZWe	edR d)œdSdT„ƒZXG dUdV„ dVejSƒZYeNe*dWœdXdY„ZZed$ d)œdZd[„Z[d$d)œd\d]„Z\eKd)œd^d_„Z]eKd)œd`da„Z^eKd)œdbdc„Z_eOeKddœdedf„Z`ejadgdh�eeOef d)œdidj„ƒZbdS )lz4Discover and run doctests in modules and test files.é    N)Úcontextmanager)ÚAny)ÚCallable)ÚDict)Ú	Generator)ÚIterable)ÚList)ÚOptional)ÚPattern)ÚSequence)ÚTuple)ÚType)ÚTYPE_CHECKING)ÚUnion)Úoutcomes)ÚExceptionInfo)ÚReprFileLocation)ÚTerminalRepr)ÚTerminalWriter©Úsafe_getattr)ÚConfig)ÚParser)ÚFixtureRequest)Ú	Collector)ÚOutcomeException)Úimport_path)Úapprox)ÚPytestWarningÚnoneZcdiffZndiffÚudiffZonly_first_failureúdoctest.OutputCheckerÚCHECKER_CLASS)ÚparserÚreturnc                 C   sœ   | j ddddgd� | j dddd	� |  d
¡}|jdddddd� |jdtjddtdd� |jddg dddd� |jdddddd� |jdddd d!d� d S )"NÚdoctest_optionflagszoption flags for doctestsÚargsÚELLIPSIS)ÚtypeÚdefaultÚdoctest_encodingzencoding used for doctest fileszutf-8)r)   Úcollectz--doctest-modulesÚ
store_trueFzrun doctests in all .py modulesÚdoctestmodules)Úactionr)   ÚhelpÚdestz--doctest-reportr    z9choose another output format for diffs on doctest failureÚdoctestreport)r(   r)   r/   Úchoicesr0   z--doctest-globÚappendÚpatz2doctests file matching pattern, default: test*.txtÚdoctestglob)r.   r)   Úmetavarr/   r0   z--doctest-ignore-import-errorszignore doctest ImportErrorsÚdoctest_ignore_import_errorsz--doctest-continue-on-failurez<for a given doctest, continue to run after the first failureÚdoctest_continue_on_failure)ZaddiniZgetgroupZ	addoptionÚstrÚlowerÚDOCTEST_REPORT_CHOICES)r#   Úgroup© r=   úI/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/_pytest/doctest.pyÚpytest_addoptionA   s^    üÿ
ûúúûûr?   ©r$   c                   C   s   d a d S ©N)ÚRUNNER_CLASSr=   r=   r=   r>   Úpytest_unconfigures   s    rC   )ÚDoctestModuleÚDoctestTextfile)ÚpathÚparentr$   c                 C   sV   |j }| jdkr4|jjrRt| ƒsRtj|| d�}|S nt|| |ƒrRtj|| d�}|S d S )Nz.py)Úfspath)	ÚconfigÚextÚoptionr-   Ú_is_setup_pyrD   Úfrom_parentÚ_is_doctestrE   )rF   rG   rI   ÚmodÚtxtr=   r=   r>   Úpytest_collect_filey   s    
rQ   )rF   r$   c                 C   s&   | j dkrdS |  ¡ }d|v p$d|v S )Nzsetup.pyFs
   setuptoolss	   distutils)ÚbasenameÚread_binary)rF   Úcontentsr=   r=   r>   rL   ‡   s    
rL   )rI   rF   r$   c                 C   sJ   |j dv r|j |¡rdS |  d¡p(dg}|D ]}|j|d�r. dS q.dS )N)z.txtz.rstTr5   z	test*.txt)ÚfnmatchF)rJ   ÚsessionZ
isinitpathÚ	getoptionÚcheck)rI   rF   rG   ÚglobsÚglobr=   r=   r>   rN   Ž   s    rN   c                   @   s<   e Zd Zeeeee f  ddœdd„Zeddœdd„Z	dS )ÚReprFailDoctestN)Úreprlocation_linesr$   c                 C   s
   || _ d S rA   )r\   )Úselfr\   r=   r=   r>   Ú__init__™   s    zReprFailDoctest.__init__)Útwr$   c                 C   s2   | j D ]&\}}|D ]}| |¡ q| |¡ qd S rA   )r\   ÚlineÚ
toterminal)r]   r_   ÚreprlocationÚlinesr`   r=   r=   r>   ra   ž   s    zReprFailDoctest.toterminal)
Ú__name__Ú
__module__Ú__qualname__r   r   r   r9   r^   r   ra   r=   r=   r=   r>   r[   ˜   s   þr[   c                       s(   e Zd Zed ddœ‡ fdd„Z‡  ZS )ÚMultipleDoctestFailureszdoctest.DocTestFailureN)Úfailuresr$   c                    s   t ƒ  ¡  || _d S rA   )Úsuperr^   rh   ©r]   rh   ©Ú	__class__r=   r>   r^   ¦   s    
z MultipleDoctestFailures.__init__)rd   re   rf   r   r^   Ú__classcell__r=   r=   rk   r>   rg   ¥   s   rg   údoctest.DocTestRunnerc                     s"   dd l ‰ G ‡ fdd„dˆ jƒ} | S )Nr   c                       st   e Zd ZdZded ee eeddœ‡ fdd„Zd	d
eddœ‡ fdd„Z	d	d
e
ee eejf ddœ‡ fdd„ZdS )z/_init_runner_class.<locals>.PytestDoctestRunnerzˆRunner to collect failures.

        Note that the out variable in this case is a list instead of a
        stdout-like object.
        Nr   Tr!   ©ÚcheckerÚverboseÚoptionflagsÚcontinue_on_failurer$   c                    s   ˆ j j| |||d� || _d S )N)rp   rq   rr   )ÚDebugRunnerr^   rs   )r]   rp   rq   rr   rs   ©Údoctestr=   r>   r^   µ   s    ÿz8_init_runner_class.<locals>.PytestDoctestRunner.__init__údoctest.DocTestzdoctest.Example)ÚtestÚexampleÚgotr$   c                    s(   ˆ   |||¡}| jr | |¡ n|‚d S rA   )ÚDocTestFailurers   r3   )r]   Úoutrx   ry   rz   Úfailureru   r=   r>   Úreport_failureÁ   s    z>_init_runner_class.<locals>.PytestDoctestRunner.report_failure)rx   ry   Úexc_infor$   c                    sX   t |d tƒr|d ‚t |d tjƒr0t d¡ ˆ  |||¡}| jrP| |¡ n|‚d S )Né   zQuitting debugger)	Ú
isinstancer   ÚbdbZBdbQuitr   ÚexitÚUnexpectedExceptionrs   r3   )r]   r|   rx   ry   r   r}   ru   r=   r>   Úreport_unexpected_exceptionÊ   s    
zK_init_runner_class.<locals>.PytestDoctestRunner.report_unexpected_exception)NNr   T)rd   re   rf   Ú__doc__r	   ÚboolÚintr^   r9   r~   r   r   ÚBaseExceptionÚtypesÚTracebackTyper…   r=   ru   r=   r>   ÚPytestDoctestRunner®   s(       ûúþúrŒ   )rv   rt   )rŒ   r=   ru   r>   Ú_init_runner_class«   s    -r�   Tro   c                 C   s   t d u rtƒ a t | |||d�S )N©rp   rq   rr   rs   )rB   r�   rŽ   r=   r=   r>   Ú_get_runnerÞ   s    ür�   c                       s¢   e Zd Zdeded ed ddœ‡ fdd„Zededddœ‡ fd	d
„ƒZddœdd„Zddœdd„Z	ddœdd„Z
ee eeef dœ‡ fdd„Zdd„ Z‡  ZS )ÚDoctestItemNz%Union[DoctestTextfile, DoctestModule]rn   rw   )ÚnamerG   ÚrunnerÚdtestr$   c                    s*   t ƒ  ||¡ || _|| _d | _d | _d S rA   )ri   r^   r’   r“   ÚobjÚfixture_request)r]   r‘   rG   r’   r“   rk   r=   r>   r^   ó   s
    zDoctestItem.__init__)rG   r‘   r’   r“   c                   s   t ƒ j||||d�S )zThe public named constructor.)r‘   rG   r’   r“   )ri   rM   )ÚclsrG   r‘   r’   r“   rk   r=   r>   rM      s    zDoctestItem.from_parentr@   c                 C   sV   | j d urRt| ƒ| _t| jjd�}| j d¡ ¡ D ]\}}|||< q2| j j |¡ d S )N)Z
getfixtureÚdoctest_namespace)r“   Ú_setup_fixturesr•   ÚdictZgetfixturevalueÚitemsrY   Úupdate)r]   rY   r‘   Úvaluer=   r=   r>   Úsetup  s    

ÿ
zDoctestItem.setupc                 C   sT   | j d usJ ‚| jd usJ ‚t| j ƒ |  ¡  g }| jj| j |d� |rPt|ƒ‚d S )N)r|   )r“   r’   Ú_check_all_skippedÚ$_disable_output_capturing_for_darwinÚrunrg   rj   r=   r=   r>   Úruntest  s    
zDoctestItem.runtestc                 C   sV   t  ¡ dkrdS | jj d¡}|rR|jdd� | ¡ \}}tj 	|¡ tj
 	|¡ dS )zFDisable output capturing. Otherwise, stdout is lost to doctest (#985).ÚDarwinNZcapturemanagerT)Zin_)ÚplatformÚsystemrI   ÚpluginmanagerZ	getpluginZsuspend_global_captureZread_global_captureÚsysÚstdoutÚwriteÚstderr)r]   Zcapmanr|   Úerrr=   r=   r>   rŸ   #  s    z0DoctestItem._disable_output_capturing_for_darwin)Úexcinfor$   c                    sà  dd l }d }t|j|j|jfƒr*|jg}nt|jtƒr>|jj}|d u�rÐg }|D �]t}|j}|j‰ ˆ j	}ˆ j
d u rxd }nˆ j
|j
 d }t|ƒj}	t|||	ƒ}
tƒ }t| j d¡ƒ}|d u�r |jjd usÎJ ‚|jj d¡}ˆ j
d usêJ ‚‡ fdd„t|ƒD ƒ}|t|j
d dƒ|j
d … }n6dg}d	}|j ¡ D ] }| d
|› d|› �¡ d}�q4t||jƒ�r€|| ||j|¡ d¡7 }n8t|jƒ}|dt|jƒ g7 }|dd„ tj|jŽ D ƒ7 }| |
|f¡ qPt |ƒS t!ƒ  "|¡S d S )Nr   r€   r1   Fc                    s&   g | ]\}}d |ˆ j  d |f ‘qS )z%03d %sr€   )Úlineno)Ú.0ÚiÚx©rx   r=   r>   Ú
<listcomp>T  s   ÿz,DoctestItem.repr_failure.<locals>.<listcomp>é	   z?EXAMPLE LOCATION UNKNOWN, not showing all tests of that examplez>>>z??? ú z...Ú
zUNEXPECTED EXCEPTION: %sc                 S   s   g | ]}|  d ¡‘qS )r´   )Ústrip©r­   r¯   r=   r=   r>   r±   i  s   ÿ)#rv   r�   rœ   r{   r„   rg   rh   ry   rx   Úfilenamer¬   r(   rd   r   Ú_get_checkerÚ_get_report_choicerI   rW   Ú	docstringÚ
splitlinesÚ	enumerateÚmaxÚsourcer3   Zoutput_differencerz   Úsplitr   r   ÚreprÚ	tracebackÚformat_exceptionr[   ri   Úrepr_failure)r]   r«   rv   rh   r\   r}   ry   r·   r¬   Úmessagerb   rp   Zreport_choicerc   Úindentr`   Zinner_excinfork   r°   r>   rÃ   /  sh    þÿ





ÿ

þ ÿÿþ

þzDoctestItem.repr_failurec                 C   s$   | j d usJ ‚| j| j jd| j fS )Nz[doctest] %s)r“   rH   r¬   r‘   )r]   r=   r=   r>   Ú
reportinfor  s    zDoctestItem.reportinfo)NN)rd   re   rf   r9   r	   r^   ÚclassmethodrM   r�   r¡   rŸ   r   r‰   r   r   rÃ   rÆ   rm   r=   r=   rk   r>   r�   ò   s,     ûúú

þCr�   c                  C   s4   dd l } t| j| j| j| j| j| jtƒ t	ƒ t
ƒ d�	S )Nr   )	ÚDONT_ACCEPT_TRUE_FOR_1ÚDONT_ACCEPT_BLANKLINEÚNORMALIZE_WHITESPACEr'   ÚIGNORE_EXCEPTION_DETAILÚCOMPARISON_FLAGSÚALLOW_UNICODEÚALLOW_BYTESÚNUMBER)rv   r™   rÈ   rÉ   rÊ   r'   rË   rÌ   Ú_get_allow_unicode_flagÚ_get_allow_bytes_flagÚ_get_number_flagru   r=   r=   r>   Ú_get_flag_lookupw  s    ÷rÓ   c                 C   s0   | j  d¡}tƒ }d}|D ]}||| O }q|S )Nr%   r   )rI   ÚgetinirÓ   )rG   Zoptionflags_strZflag_lookup_tableZflag_accÚflagr=   r=   r>   Úget_optionflags‡  s    rÖ   c                 C   s    |   d¡}|r|   d¡rd}|S )Nr8   ZusepdbF)Úgetvalue)rI   rs   r=   r=   r>   Ú_get_continue_on_failure�  s
    

rØ   c                   @   s"   e Zd ZdZee dœdd„ZdS )rE   Nr@   c                 c   s”   dd l }| j d¡}| j |¡}t| jƒ}| jj}ddi}t| ƒ}td|t	ƒ t
| jƒd�}| ¡ }	|	 ||||d¡}
|
jr�tj| |
j||
d�V  d S )Nr   r*   rd   Ú__main__F©rq   rr   rp   rs   ©r‘   r’   r“   )rv   rI   rÔ   rH   Ú	read_textr9   rR   rÖ   r�   r¸   rØ   ZDocTestParserZget_doctestÚexamplesr�   rM   r‘   )r]   rv   ÚencodingÚtextr·   r‘   rY   rr   r’   r#   rx   r=   r=   r>   r+   �  s&    
ü
ÿzDoctestTextfile.collect)rd   re   rf   r”   r   r�   r+   r=   r=   r=   r>   rE   š  s   rE   rw   )rx   r$   c                    s2   ddl ‰ t‡ fdd„| jD ƒƒ}|r.t d¡ dS )zVRaise pytest.skip() if all examples in the given DocTest have the SKIP
    option set.r   Nc                 3   s   | ]}|j  ˆ jd ¡V  qdS )FN)ÚoptionsÚgetZSKIPr¶   ru   r=   r>   Ú	<genexpr>¾  ó    z%_check_all_skipped.<locals>.<genexpr>z!all tests skipped by +SKIP option)rv   ÚallrÝ   ÚpytestÚskip)rx   Zall_skippedr=   ru   r>   rž   ¹  s    rž   )r”   r$   c                 C   s   t | ddƒduS )zmReturn if an object is possibly a mock object by checking the
    existence of a highly improbable attribute.Z1pytest_mock_example_attribute_that_shouldnt_existNr   ©r”   r=   r=   r>   Ú
_is_mockedÃ  s    
ÿÿrè   )NNNc                  #   s\   t j‰ ddœtdtf tttgtf  tdœ‡ fdd„} | t _zdV  W ˆ t _nˆ t _0 dS )z€Context manager which replaces ``inspect.unwrap`` with a version
    that's aware of mock objects and doesn't recurse into them.N©Ústop.)Úfuncrê   r$   c             
      sz   z:|d u s|t u r ˆˆt d�W S |‰ ˆˆ‡ ‡fdd„d�W S  tyt } z"t d|ˆf t¡ ‚ W Y d }~n
d }~0 0 d S )Nré   c                    s   t | ƒpˆ ˆƒS rA   )rè   rç   ©Ú_stoprë   r=   r>   Ú<lambda>Ù  rã   zF_patch_unwrap_mock_aware.<locals>._mock_aware_unwrap.<locals>.<lambda>z˜Got %r when unwrapping %r.  This is usually caused by a violation of Python's object protocol; see e.g. https://github.com/pytest-dev/pytest/issues/5080)rè   Ú	ExceptionÚwarningsÚwarnr   )rë   rê   Úe©Zreal_unwraprì   r>   Ú_mock_aware_unwrapÒ  s    þüz4_patch_unwrap_mock_aware.<locals>._mock_aware_unwrap)ÚinspectÚunwrapr   r   r	   )rô   r=   ró   r>   Ú_patch_unwrap_mock_awareÌ  s    ÿþr÷   c                   @   s   e Zd Zee dœdd„ZdS )rD   r@   c                 #   sâ   dd l ‰ G ‡ fdd„dˆ jƒ}| jjdkrF| jj | j| j d¡¡}nBzt| jƒ}W n2 t	y†   | j 
d¡r€t d| j ¡ n‚ Y n0 |ƒ }t| ƒ}td|tƒ t| jƒd	�}| ||j¡D ] }|jr¼tj| |j||d
�V  q¼d S )Nr   c                       s.   e Zd ZdZ‡ fdd„Zddœ‡ fdd„ZdS )z5DoctestModule.collect.<locals>.MockAwareDocTestFinderzÇA hackish doctest finder that overrides stdlib internals to fix a stdlib bug.

            https://github.com/pytest-dev/pytest/issues/3456
            https://bugs.python.org/issue25532
            c                    s&   t |tƒrt|d|ƒ}ˆ j | ||¡S )zªDoctest code does not take into account `@property`, this
                is a hackish way to fix it.

                https://bugs.python.org/issue17446
                Úfget)r�   ÚpropertyÚgetattrÚDocTestFinderÚ_find_lineno)r]   r”   Úsource_linesru   r=   r>   rü   õ  s
    
ÿzBDoctestModule.collect.<locals>.MockAwareDocTestFinder._find_linenoNr@   c                    sP   t |ƒrd S tƒ �* ˆ j | |||||||¡ W d   ƒ n1 sB0    Y  d S rA   )rè   r÷   rû   Ú_find)r]   Útestsr”   r‘   Úmodulerý   rY   Úseenru   r=   r>   rþ     s    ÿz;DoctestModule.collect.<locals>.MockAwareDocTestFinder._find)rd   re   rf   r†   rü   rþ   r=   ru   r=   r>   ÚMockAwareDocTestFinderî  s   þr  zconftest.pyZ
importmoder7   zunable to import module %rFrÚ   rÛ   )rv   rû   rH   rR   rI   r¥   Z_importconftestrW   r   ÚImportErrorr×   rå   ræ   rÖ   r�   r¸   rØ   Úfindrd   rÝ   r�   rM   r‘   )r]   r  r   Úfinderrr   r’   rx   r=   ru   r>   r+   ë  s2     ÿü
ÿzDoctestModule.collectN)rd   re   rf   r   r�   r+   r=   r=   r=   r>   rD   ê  s   rD   )Údoctest_itemr$   c                 C   sH   ddœdd„}i | _ | jj}|j| |ddd�| _t| dd�}| ¡  |S )	zEUsed by DoctestTextfile and DoctestItem to setup fixture information.Nr@   c                   S   s   d S rA   r=   r=   r=   r=   r>   rë   .  s    z_setup_fixtures.<locals>.funcF)Únoderë   r–   ÚfuncargsT)Z	_ispytest)r  rV   Z_fixturemanagerZgetfixtureinfoZ_fixtureinfor   Z_fillfixtures)r  rë   Zfmr•   r=   r=   r>   r˜   +  s    ÿr˜   c                     s,   dd l ‰ dd l‰G ‡ ‡fdd„dˆ jƒ} | S )Nr   c                       sb   e Zd Z” d”j¡Z” d”j¡Z” d”j¡Ze	e	e
edœ‡ ‡fdd„Ze	e	e	dœdd	„Zd
S )z2_init_checker_class.<locals>.LiteralsOutputCheckerz(\W|^)[uU]([rR]?[\'\"])z(\W|^)[bB]([rR]?[\'\"])aÍ  
            (?P<number>
              (?P<mantissa>
                (?P<integer1> [+-]?\d*)\.(?P<fraction>\d+)
                |
                (?P<integer2> [+-]?\d+)\.
              )
              (?:
                [Ee]
                (?P<exponent1> [+-]?\d+)
              )?
              |
              (?P<integer3> [+-]?\d+)
              (?:
                [Ee]
                (?P<exponent2> [+-]?\d+)
              )
            )
            )Úwantrz   rr   r$   c                    s¸   ˆ j  | |||¡rdS |tƒ @ }|tƒ @ }|tƒ @ }|sD|sD|sDdS tt ttdœ‡fdd„}|rz|| j|ƒ}|| j|ƒ}|r–|| j|ƒ}|| j|ƒ}|r¦|  	||¡}ˆ j  | |||¡S )NTF)ÚregexrP   r$   c                    s   ˆ   | d|¡S )Nz\1\2)Úsub)r
  rP   )Úrer=   r>   Úremove_prefixesh  s    zX_init_checker_class.<locals>.LiteralsOutputChecker.check_output.<locals>.remove_prefixes)
ÚOutputCheckerÚcheck_outputrÐ   rÑ   rÒ   r
   r9   Ú_unicode_literal_reÚ_bytes_literal_reÚ_remove_unwanted_precision)r]   r	  rz   rr   Zallow_unicodeZallow_bytesZallow_numberr  ©rv   r  r=   r>   r  ]  s"    


z?_init_checker_class.<locals>.LiteralsOutputChecker.check_output)r	  rz   r$   c                 S   s  t | j |¡ƒ}t | j |¡ƒ}t|ƒt|ƒkr4|S d}t||ƒD ]Ò\}}| d¡}| d¡}	|	d u rp| d¡}	|d u r~d}
nt|ƒ}
|	d urš|
t|	ƒ8 }
t| ¡ ƒtt| ¡ ƒd|
  d�krB|d | 	¡ | … | ¡  || 
¡ | d …  }|| 
¡ | 	¡  | 
¡ | 	¡   7 }qB|S )Nr   ÚfractionZ	exponent1Z	exponent2é
   )Úabs)ÚlistÚ
_number_reÚfinditerÚlenÚzipr<   rˆ   Úfloatr   ÚstartÚend)r]   r	  rz   ZwantsÚgotsÚoffsetÚwÚgr  ÚexponentZ	precisionr=   r=   r>   r  x  s(    


&.ÿ&zM_init_checker_class.<locals>.LiteralsOutputChecker._remove_unwanted_precisionN)rd   re   rf   ÚcompileÚUNICODEr  r  ÚVERBOSEr  r9   rˆ   r‡   r  r  r=   r  r=   r>   ÚLiteralsOutputChecker?  s   ìr'  )rv   r  r  )r'  r=   r  r>   Ú_init_checker_class;  s    Tr(  c                   C   s   t du rtƒ a t ƒ S )aà  Return a doctest.OutputChecker subclass that supports some
    additional options:

    * ALLOW_UNICODE and ALLOW_BYTES options to ignore u'' and b''
      prefixes (respectively) in string literals. Useful when the same
      doctest should run in Python 2 and Python 3.

    * NUMBER to ignore floating-point differences smaller than the
      precision of the literal number in the doctest.

    An inner class is used to avoid importing "doctest" at the module
    level.
    N)r"   r(  r=   r=   r=   r>   r¸   –  s    r¸   c                  C   s   ddl } |  d¡S )z+Register and return the ALLOW_UNICODE flag.r   NrÍ   ©rv   Zregister_optionflagru   r=   r=   r>   rÐ   ª  s    rÐ   c                  C   s   ddl } |  d¡S )z)Register and return the ALLOW_BYTES flag.r   NrÎ   r)  ru   r=   r=   r>   rÑ   ±  s    rÑ   c                  C   s   ddl } |  d¡S )z$Register and return the NUMBER flag.r   NrÏ   r)  ru   r=   r=   r>   rÒ   ¸  s    rÒ   )Úkeyr$   c              
   C   s,   ddl }t|jt|jt|jt|jt	di|  S )zÓReturn the actual `doctest` module flag value.

    We want to do it as late as possible to avoid importing `doctest` and all
    its dependencies when parsing options, as it adds overhead and breaks tests.
    r   N)
rv   ÚDOCTEST_REPORT_CHOICE_UDIFFZREPORT_UDIFFÚDOCTEST_REPORT_CHOICE_CDIFFZREPORT_CDIFFÚDOCTEST_REPORT_CHOICE_NDIFFZREPORT_NDIFFÚ(DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILUREZREPORT_ONLY_FIRST_FAILUREÚDOCTEST_REPORT_CHOICE_NONE)r*  rv   r=   r=   r>   r¹   ¿  s    ûúr¹   rV   )Zscopec                   C   s   t ƒ S )zaFixture that returns a :py:class:`dict` that will be injected into the
    namespace of doctests.)r™   r=   r=   r=   r>   r—   Ð  s    r—   )NNr   T)cr†   r‚   rõ   r£   r¦   rÁ   rŠ   rð   Ú
contextlibr   Útypingr   r   r   r   r   r   r	   r
   r   r   r   r   r   Zpy.pathÚpyrå   Z_pytestr   Z_pytest._code.coder   r   r   Z_pytest._ior   Z_pytest.compatr   Z_pytest.configr   Z_pytest.config.argparsingr   Z_pytest.fixturesr   Z_pytest.nodesr   Z_pytest.outcomesr   Z_pytest.pathlibr   Z_pytest.python_apir   Z_pytest.warning_typesr   rv   r/  r,  r-  r+  r.  r;   rB   r"   Ú__annotations__r?   rC   rF   ÚlocalrQ   r‡   rL   rN   r[   rï   rg   r�   rˆ   r�   ZItemr�   r9   rÓ   rÖ   rØ   ÚModulerE   rž   Úobjectrè   r÷   rD   r˜   r(  r¸   rÐ   rÑ   rÒ   r¹   Zfixturer—   r=   r=   r=   r>   Ú<module>   sº   û	2
þ
4    üû 	

	A[
