o
    LK&h                     @   st   d 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
Z
G dd deZe
jd	d
 ZG dd dZdS )zTests for distutils.cmd.    N)debug)Command)Distribution)DistutilsOptionErrorc                   @   s   e Zd Zdd ZdS )MyCmdc                 C   s   d S N )selfr   r   W/var/www/html/venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_cmd.pyinitialize_options   s   zMyCmd.initialize_optionsN)__name__
__module____qualname__r   r   r   r   r
   r      s    r   c                 C   s
   t t S r   )r   r   )requestr   r   r
   cmd   s   
r   c                   @   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 )TestCommandc                 C   s  g d|_ g d|_t |_d|_|d |d tt |d W d    n1 s0w   Y  tt |d W d    n1 sJw   Y  d|_	|d	 |j	dd
gks`J ddg|_
|d ddg|_tt |d W d    d S 1 sw   Y  d S )N)one   three)r   twor   okyes_string_listyes_string_list2not_string_listnot_string_list2zok,dokoption1dokxxxwwwoption2r   option3)r   r   objectr   r   ensure_string_listpytestraisesr   r   r   r    r	   r   r   r   r
   test_ensure_string_list   s*   







"z#TestCommand.test_ensure_string_listc                 C   sf   t t |jddddd W d    n1 sw   Y  dd }d|_||_|jdd	ddd d S )
NT funcr   )infilesoutfiler(   argsc                 S   s   |dksJ d S )Nzgenerating out from inr   )r(   r+   exec_msglevelr   r   r
   _execute6   s   z,TestCommand.test_make_file.<locals>._executeinout)r#   r$   	TypeError	make_fileforceexecute)r	   r   r.   r   r   r
   test_make_file0   s   zTestCommand.test_make_filec                    sL   g   fdd}||_ d|_d|_ddg|_|  g d} |ks$J d S )Nc                    s     |  d S r   )append)msgr-   msgsr   r
   	_announce@   s   z0TestCommand.test_dump_options.<locals>._announce   )r   r'   r'   )r   r'   r'   )zcommand options for 'MyCmd':z  option1 = 1z  option2 = 1)announcer   r   user_optionsdump_options)r	   r   r:   wantedr   r8   r
   test_dump_options=   s   
zTestCommand.test_dump_optionsc                 C   sp   d|_ |d d |_|dd t|dsJ d|_tt |d W d    d S 1 s1w   Y  d S )Nr   r   r   r   r;   r    )r   ensure_stringr   hasattrr    r#   r$   r   r%   r   r   r
   test_ensure_stringL   s   
"zTestCommand.test_ensure_stringc                 C   sP   t |_|d d|_tt |d W d    d S 1 s!w   Y  d S Nr   r   r   )__file__r   ensure_filenamer   r#   r$   r   r%   r   r   r
   test_ensure_filenameX   s   
"z TestCommand.test_ensure_filenamec                 C   s^   t jtpt j|_|d d|_t	t
 |d W d    d S 1 s(w   Y  d S rD   )ospathdirnamerE   curdirr   ensure_dirnamer   r#   r$   r   r%   r   r   r
   test_ensure_dirname_   s   
"zTestCommand.test_ensure_dirnamec                 C   sJ   | d | jdksJ |tdd | d | jdks#J d S )Nr   r'   DEBUGTzxxx
)debug_print
readouterrr0   setattrr   )r	   r   capsysmonkeypatchr   r   r
   test_debug_printf   s
   

zTestCommand.test_debug_printN)
r   r   r   r&   r5   r@   rC   rG   rM   rT   r   r   r   r
   r      s    r   )__doc__rH   	distutilsr   distutils.cmdr   distutils.distr   distutils.errorsr   r#   r   fixturer   r   r   r   r   r
   <module>   s    
