a
    ߙfb                     @   sF   d dl Z d dlZd dlZd dlZd dlZd dlmZ G dd dZdS )    N)fitsc                   @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )FitsTestCasec                 C   sJ   t jt jtd| _tjdd| _dt	j
_dt	j
_dt	j
_dt	j
_d S )Ndataz
fits-test-)prefixTF)ospathjoindirname__file__data_dirtempfileZmkdtemptemp_dirr   conf"enable_record_valued_keyword_cardsextension_name_case_sensitivestrip_header_whitespace
use_memmap)self r   =lib/python3.9/site-packages/astropy/io/fits/tests/__init__.pysetup   s    zFitsTestCase.setupc                 C   s   t | dr\tj| jr\d}|r\zt| j W q\W q tyX   t	d |d8 }Y q0 qt
jd t
jd t
jd t
jd d S )	Nr      g      ?   r   r   r   r   )hasattrr   r   existsr   shutilZrmtreeOSErrortimesleepr   r   reset)r   Ztriesr   r   r   teardown   s    
zFitsTestCase.teardownc                 C   s6   t | || | t| |tjtjB  dS )zdCopies a backup of a test data file to the temp dir and sets its
        mode to writeable.
        N)	r   copyr   tempr   chmodstatS_IREADS_IWRITEr   filenamer   r   r   	copy_file,   s    zFitsTestCase.copy_filec                 C   s   t j| j|S )z%Returns the path to a test data file.)r   r   r   r   r'   r   r   r   r   4   s    zFitsTestCase.datac                 C   s   t j| j|S )z6 Returns the full path to a file in the test temp dir.)r   r   r   r   r'   r   r   r   r"   9   s    zFitsTestCase.tempN)__name__
__module____qualname__r   r    r)   r   r"   r   r   r   r   r      s
   r   )r   r   r$   r   r   Z
astropy.ior   r   r   r   r   r   <module>   s   