a
     ¬<b  ã                   @   s.   d Z ddlZddlZG dd„ dƒZdd„ ZdS )zN
This module adds context manager for temporary files generated by the tests.
é    Nc                   @   sH   e Zd ZdZedƒZedƒZed
dd„ƒZeddd„ƒZ	edd„ ƒZ
d	S )ÚTmpFileManagerzP
    A class to track record of every temporary files created by the tests.
    Ú c                 C   s   | j  |¡ |S ©N)Ú	tmp_filesÚadd©ÚclsÚname© r
   úf/Users/vegardjervell/Documents/master/model/venv/lib/python3.9/site-packages/sympy/testing/tmpfiles.pyÚtmp_file   s    zTmpFileManager.tmp_filec                 C   s   | j  |¡ |S r   )Útmp_foldersr   r   r
   r
   r   Ú
tmp_folder   s    zTmpFileManager.tmp_folderc                 C   sH   | j r(| j  ¡ }tj |¡r t |¡ q | jrD| j ¡ }t |¡ q(d S r   )	r   ÚpopÚosÚpathÚisfileÚremover   ÚshutilÚrmtree)r   ÚfileÚfolderr
   r
   r   Úcleanup   s    

zTmpFileManager.cleanupN)r   )r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úsetr   r   Úclassmethodr   r   r   r
   r
   r
   r   r   	   s   r   c                    s   ‡ fdd„}|S )zP
    A decorator to help test codes remove temporary files after the tests.
    c                      s"   zˆ ƒ  W t  ¡  n
t  ¡  0 d S r   )r   r   r
   ©Ú	test_funcr
   r   Úwrapper_function(   s    z+cleanup_tmp_files.<locals>.wrapper_functionr
   )r    r!   r
   r   r   Úcleanup_tmp_files$   s    r"   )r   r   r   r   r"   r
   r
   r
   r   Ú<module>   s   