B
    dUc                 @   s@   d Z ddlmZ ddlmZmZ ddlmZ G dd deZdS )a0  
This plugin provides assert introspection. When the plugin is enabled
and a test failure occurs, the traceback is displayed with extra context
around the line in which the exception was raised. Simple variable 
substitution is also performed in the context output to provide more
debugging information.
    )Plugin)exc_to_unicodeforce_unicode)inspect_tracebackc               @   s,   e Zd ZdZdZdd Zdd Zdd Zd	S )
FailureDetailzP
    Plugin that provides extra information in tracebacks of test failures.
    i@  c          	   C   s"   |j dddd|dddd d	S )
z'Register commmandline options.
        z-dz--detailed-errorsz--failure-detail
store_trueZNOSE_DETAILED_ERRORSdetailedErrorszZAdd detail to error output by attempting to evaluate failed asserts [NOSE_DETAILED_ERRORS])actiondefaultdesthelpN)Z
add_optionget)selfparserenv r   9lib/python3.7/site-packages/nose/plugins/failuredetail.pyoptions   s
    zFailureDetail.optionsc             C   s   | j s
dS |j| _|| _dS )zConfigure plugin.
        N)Zcan_configurer   Zenabledconf)r   r   r   r   r   r   	configure   s    zFailureDetail.configurec             C   sF   |\}}}dt | }}|r6tt|}d||g}||_|||fS )zLAdd detail from traceback inspection to error message of a failure.
        N
)r   r   r   jointbinfo)r   ZtesterrZecZevtbr   Zstr_evr   r   r   formatFailure&   s    
zFailureDetail.formatFailureN)__name__
__module____qualname____doc__Zscorer   r   r   r   r   r   r   r      s
   r   N)	r   Znose.pluginsr   Znose.pyversionr   r   Znose.inspectorr   r   r   r   r   r   <module>   s   