o
    i                     @   sN   d Z ddlZddlmZ ddlmZmZ ddlZddlZe	d dd Z
dS )z2Tests for tinypages build using sphinx extensions.    N)Path)PopenPIPEsphinxc              
      s  t | }|d  |d }tjdddddt|tt tjd t g	}t|ttdd	}| \}}|j	d
ks>J d
|||rHtd
|   sNJ  fddfddtddD \}}}	t|dsmJ t|	dswJ t|dsJ t|dsJ t|dsJ t|	dsJ  d  }
d|
v sJ t|	 d sJ t| d sJ d|
v sJ d S )Nhtmldoctreesz-msphinxz-Wz-bz-d	tinypagesT)stdoutstderruniversal_newlinesr   z/sphinx build failed with stdout:
{}
stderr:
{}
z/sphinx build emitted the following warnings:
{}c                    s    d|  d S )Nzsome_plots-z.png )num)html_dirr   Z/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/matplotlib/tests/test_sphinxext.py	plot_file    s   z!test_tinypages.<locals>.plot_filec                    s   g | ]} |qS r   r   ).0i)r   r   r   
<listcomp>#   s    z"test_tinypages.<locals>.<listcomp>               12_0012_01   zsome_plots.htmls   # Only a commentz
range4.pngz
range6.pngs    This is the caption for plot 15.)r   sys
executablestr__file__parentr   r   communicate
returncodeformatpytestfailis_dirrangefilecmpcmp
read_bytes)tmpdirtmp_pathdoctree_dircmdprocouterrrange_10range_6range_4html_contentsr   )r   r   r   test_tinypages   s<   
r6   )__doc__r(   pathlibr   
subprocessr   r   r   r$   importorskipr6   r   r   r   r   <module>   s    
