o
    Zh3                     @   sR   d dl Z d dlmZ d dlZd dlmZ d dlmZ d dlm	Z	 G dd dZ
dS )    N)mock)
build_clib)Distribution)DistutilsSetupErrorc                   @   s0   e Zd Zeddd Zeddd ZdS )TestBuildCLibz2setuptools.command.build_clib.newer_pairwise_groupc                 C   s  t  }t|}dddifg}tt || W d    n1 s#w   Y  d}ddg|dfg}tt || W d    n1 sHw   Y  ddi}ddg|dfg}tt || W d    n1 sow   Y  ddi}ddg|dfg}tt || W d    n1 sw   Y  tj|jd|_g g f|_	d	d
d}ddg|dfg}|| g dg|j
d v sJ |jjjrJ |jjjdksJ |j  d|_	|| |jjjdksJ |jjjdksJ d S )Nexamplesourceszbroken.cZsome_stringzsource.cr   obj_deps specglobal.h	example.hr   	example.cr   )r   r   r   r      )r   r   pytestZraisesr   build_librariesr   	MagicMockcompilerreturn_value	call_argscompileZcalledZcreate_static_libZ
call_countZ
reset_mock)self
mock_newerdistcmdlibsr
    r!   W/var/www/html/lang_env/lib/python3.10/site-packages/setuptools/tests/test_build_clib.pytest_build_libraries   sD   




z"TestBuildCLib.test_build_librariesc           	      C   s   t  }t|}tj|jd|_g g f|_ddg}|}ddd}d||dfg}|| |jd	 }||krAt	|t
|}||ks5d||dfg}|| ||jd	 ksWJ d S )
Nr   za-example.cr   r   r   r   r   r	   r   )r   r   r   r   r   r   r   r   randomsamplelen)	r   r   r   r   Zoriginal_sourcesr   r
   r    Zcomputed_call_argsr!   r!   r"   !test_build_libraries_reproducible<   s    




z/TestBuildCLib.test_build_libraries_reproducibleN)__name__
__module____qualname__r   patchr#   r'   r!   r!   r!   r"   r      s
    
.r   )r$   Zunittestr   r   Zsetuptools.command.build_clibr   Zsetuptools.distr   Zdistutils.errorsr   r   r!   r!   r!   r"   <module>   s    