3
$ßL]ý  ã               @   sB   d dl mZ d dlZd dlZd dlZejdƒZdd„ Zdd„ ZdS )é    )ÚPathNÚnbformatc             C   sh   t jddd��<}tjdddddd	d
|j| g	ƒ |jdƒ tj|tjƒ}W dQ R X dd„ |j	D ƒ}||fS )znExecute a notebook via nbconvert and collect output.
       :returns (parsed nb object, execution errors)
    z.ipynbzw+t)ÚsuffixÚmodeZjupyterZ	nbconvertz--toZnotebookz	--executez!--ExecutePreprocessor.timeout=500z--outputr   Nc             S   s0   g | ](}d |kr|d  D ]}|j dkr|‘qqS )ÚoutputsÚerror)Úoutput_type)Ú.0ÚcellÚoutput© r   úK/tmp/pip-install-edjban26/matplotlib/matplotlib/tests/test_backend_nbagg.pyú
<listcomp>   s    
z!_notebook_run.<locals>.<listcomp>)
ÚtempfileÚNamedTemporaryFileÚ
subprocessÚ
check_callÚnameÚseekr   ÚreadZcurrent_nbformatÚcells)Znb_fileÚfoutÚnbÚerrorsr   r   r   Ú_notebook_run   s    
r   c              C   s&   t ttƒjd ƒ\} }|g ks"t‚d S )Nztest_nbagg_01.ipynb)r   r   Ú__file__ÚparentÚAssertionError)r   r   r   r   r   Ú
test_ipynb   s    r   )	Zpathlibr   r   r   ZpytestZimportorskipr   r   r   r   r   r   r   Ú<module>   s   
