
    ;e                         	 d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZmZ  G d de
j        e
j        e
j        ej                  Zd	 Zed
k    r e e                       dS dS )    N)install_lib)	Extension)support)DistutilsOptionError)run_unittestrequires_subprocessc                       e Zd Zd Z ej        ej        d           e            d                         Z	d Z
d Z e            d             ZdS )InstallLibTestCasec                    |                                  d         }t          |          }|                                 |                     |j        d           |                     |j        d           d|_        |                     t          |j                   d|_        |                     t          |j                   d|_        |                                 |                     |j        d           d S )N   r   foo42   )create_distr   finalize_optionsassertEqualcompileoptimizeassertRaisesr   )selfdistcmds      7/usr/lib/python3.11/distutils/tests/test_install_lib.pytest_finalize_optionsz(InstallLibTestCase.test_finalize_options   s    !!!$$a(((q))) .0DEEE.0DEEEq)))))    zbyte-compile disabledc                    |                                  \  }}t          j        |           t          |          }dx|_        |_        t          j                            |d          }|                     |d           |	                    |g           t          j                            dd          }t          j                            d|j                  }|                     t          j                            |                     |                     t          j                            |                     d S )Nr   zfoo.pyz# python file )optimization)r   oschdirr   r   r   pathjoin
write_filebyte_compile	importlibutilcache_from_source
assertTrueexists)r   project_dirr   r   fpyc_filepyc_opt_files          r   test_byte_compilez$InstallLibTestCase.test_byte_compile%   s	    !,,..T
$%&&clGLLh//?+++!>33H23NN ~77AD 8 O Ox00111|4455555r   c                 8   |                                  \  }}t          j        |           t          j        d           t	          |          }dx|_        |_        |                                 |_        t          j	        
                    |dd          }|                     |d           t          ddg          g|j        _        dg|j        _        d|j        _        |                                }|                     t'          |          d|           d S )	Nspamr   __init__.py# python packager   xxxsetup.py   )r   r    r!   mkdirr   r   r   mkdtempinstall_dirr"   r#   r$   r   distributionext_modulespackagesscript_nameget_outputsr   len)r   r+   r   r   r,   outputss         r   test_get_outputsz#InstallLibTestCase.test_get_outputs6   s     ,,..T

$ &'&cl,,..GLLfm<<-...(1%%(A(A'B$%+H!'1$ //##Wq'22222r   c                 8   |                                  \  }}t          j        |           t          j        d           t	          |          }dx|_        |_        |                                 |_        t          j	        
                    |dd          }|                     |d           t          ddg          g|j        _        dg|j        _        d|j        _        |                                }|                     t'          |          d|           d S )	Nr1   r   r2   r3   r   r4   r5   r   )r   r    r!   r7   r   r   r   r8   r9   r"   r#   r$   r   r:   r;   r<   r=   
get_inputsr   r?   )r   r+   r   r   r,   inputss         r   test_get_inputsz"InstallLibTestCase.test_get_inputsJ   s     ,,..T

$ &'&cl,,..GLLfm<<-...(1%%(A(A'B$%+H!'1$ !!Va00000r   c                    |                                  d         }t          |          }d|_        d|_        t          j        }dt          _        	 |                    g            |t          _        n# |t          _        w xY w|                     d| j        d         d         | j        d         d         z             d S )Nr   Tzbyte-compiling is disabledr   r   )	r   r   r   r   sysdont_write_bytecoder%   assertInlogs)r   r   r   old_dont_write_bytecodes       r   test_dont_write_bytecodez+InstallLibTestCase.test_dont_write_bytecode^   s     !!!$$"%"9"&	>R   &=C##&=C#====2il1o	!Q7	9 	9 	9 	9 	9s   A3 3BN)__name__
__module____qualname__r   unittestskipIfrG   rH   r   r/   rA   rE   rL    r   r   r
   r
      s        
* * *$ X_S,.EFF6 6  GF63 3 3(1 1 1( 9 9 9 9 9r   r
   c                  X    t          j                                        t                    S )N)rP   
TestLoaderloadTestsFromTestCaser
   rR   r   r   
test_suiterV   q   s       667IJJJr   __main__)rG   r    importlib.utilr&   rP   distutils.command.install_libr   distutils.extensionr   distutils.testsr   distutils.errorsr   test.supportr   r   TempdirManagerLoggingSilencerEnvironGuardTestCaser
   rV   rM   rR   r   r   <module>rb      s   / 



 				      5 5 5 5 5 5 ) ) ) ) ) ) # # # # # # 1 1 1 1 1 1 : : : : : : : :`9 `9 `9 `9 `9/ 0 -!*`9 `9 `9FK K K zL r   