a
    Nˆc  ã                   @   s‚   d dl Z d dlZd dlZd dlmZ zd dlmZ W n  e	yT   ej
ddd� Y n0 ej d¡dd„ ƒZej d¡d	d
„ ƒZdS )é    N)Ú_macosxzThese are mac only testsT)Zallow_module_levelÚmacosxc                  C   sR   t  d¡} | j ¡  | j ¡ jd us(J ‚t  d¡} |  ¡  | j ¡ jd usNJ ‚d S )Né   é   )ÚpltÚfigureÚcanvasZdrawZget_rendererZ	_rendererZdraw_without_rendering)Úfig© r
   úg/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/matplotlib/tests/test_backend_macosx.pyÚtest_cached_renderer   s    


r   c                    sœ   ‡ fdd„}|   td|¡ t ¡ }t dˆ i¡�X |jj ¡  ˆ › d|j 	¡ › �}t
j |¡sbJ ‚tjd ˆ › d�kszJ ‚W d   ƒ n1 sŽ0    Y  d S )Nc                    s.   |t ˆ ƒksJ ‚t |› d�¡ |› d|› �S )Nú/testú/test/)ÚstrÚosÚmakedirs)ÚtitleÚ	directoryÚfilename©Útmp_pathr
   r   Únew_choose_save_file   s    z2test_savefig_rcparam.<locals>.new_choose_save_fileZchoose_save_filezsavefig.directoryr   r   )Úsetattrr   r   r   ÚmplZ
rc_contextr   ZtoolbarZsave_figureZget_default_filenamer   ÚpathÚexistsZrcParams)Zmonkeypatchr   r   r	   Z	save_filer
   r   r   Útest_savefig_rcparam   s    r   )r   ZpytestZ
matplotlibr   Zmatplotlib.pyplotZpyplotr   Zmatplotlib.backendsr   ÚImportErrorÚskipÚmarkÚbackendr   r   r
   r
   r
   r   Ú<module>   s   


