o
    LK&h}                     @   s   d Z ddlZddlZddlmZmZmZmZ ddlm	Z	 ddl
mZ ddlZG dd dejZejdd	 Zd
d Zdd ZdS )zTests for distutils._modified.    N)newernewer_groupnewer_pairwisenewer_pairwise_group)DistutilsFileError)supportc                   @   sD   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dS )TestDepUtilc                 C   s   |   }tj|d}tjt}tt t	|| W d    n1 s&w   Y  | 
| t	|ds7J t	||s>J t	||rEJ d S )NnewI_dont_exist)mkdtempospathjoinabspath__file__pytestraisesr   r   
write_file)selftmpdirnew_fileold_file r   \/var/www/html/venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_modified.py
test_newer   s   
zTestDepUtil.test_newerc                 C   s   |   }tj|d}tj|d}t| t| tj|d}tj|d}tjt}tj|d}| | | | | | ||||fS )Nsourcestargetsonetwofour)r   r   r   r   mkdirr   r   r   )r   r   r   r   r   r   threer   r   r   r   _setup_1234    s   




zTestDepUtil._setup_1234c                 C   s6   |   \}}}}t||g||g|g|gfksJ d S Nr"   r   r   r   r   r!   r   r   r   r   test_newer_pairwise/   s   &zTestDepUtil.test_newer_pairwisec                 C   s   |   \}}}}tt t|g||g W d    n1 s w   Y  tt t||g|g W d    d S 1 s>w   Y  d S r#   )r"   r   r   
ValueErrorr   r%   r   r   r   test_newer_pairwise_mismatch4   s   "z(TestDepUtil.test_newer_pairwise_mismatchc                 C   s   t g g g g fksJ d S r#   )r   )r   r   r   r   test_newer_pairwise_empty=   s   z%TestDepUtil.test_newer_pairwise_emptyc                 C   s2   |   \}}}}t||g||gg g fksJ d S r#   r$   r%   r   r   r   test_newer_pairwise_fresh@   s   "z%TestDepUtil.test_newer_pairwise_freshc                 C   s  |   }tj|d}t| tj|d}tj|d}tj|d}tjt}| | | | | | t|||g|sDJ t|||g|rNJ t	| t
t t|||g| W d    n1 skw   Y  t|||g|ddr|J t|||g|ddsJ d S )Nr   r   r   r!   ignore)missingr   )r   r   r   r   r    r   r   r   r   remover   r   OSError)r   r   r   r   r   r!   r   r   r   r   test_newer_groupE   s$   




zTestDepUtil.test_newer_groupN)
__name__
__module____qualname__r   r"   r&   r(   r)   r*   r/   r   r   r   r   r      s    	r   c                    sn   g d} fdd|D }t |D ]\}}|jddd t|||f qtj|dd |d |d	d d
S )zt
    Set up some older sources, a target, and newer sources.

    Returns a simple namespace with these values.
    )zolder.czolder.hztarget.oznewer.cznewer.hc                    s   g | ]} | qS r   r   ).0nametmp_pathr   r   
<listcomp>h   s    z!groups_target.<locals>.<listcomp> zutf-8)encodingN      )oldertargetr   )	enumerate
write_textr   utimetypesSimpleNamespace)r6   	filenamespathsmtimer   r   r5   r   groups_target`   s   $rF   c                 C   sP   t | jg| jg}t | jg| jg}|g g fksJ || jg| jgfks&J d S r#   )r   r<   r=   r   )rF   r<   r   r   r   r   test_newer_pairwise_groups   s   rG   c                 C   s   t g t| d sJ dS )z4
    Consider no sources and no target "newer".
    zdoes-not-existN)r   strr5   r   r   r   %test_newer_group_no_sources_no_targetz   s   rI   )__doc__r   rA   distutils._modifiedr   r   r   r   distutils.errorsr   distutils.testsr   r   TempdirManagerr   fixturerF   rG   rI   r   r   r   r   <module>   s    T
