
    e                         d 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  G d d	e          Z G d
 dej                  Zedk    r ej                     dS dS )zTests for distutils.cmd.    N)captured_stdout)Command)Distribution)DistutilsOptionError)debugc                       e Zd Zd ZdS )MyCmdc                     d S N )selfs    *  /home/conda/feedstock_root/build_artifacts/python-split_1708115622739/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.11/distutils/tests/test_cmd.pyinitialize_optionszMyCmd.initialize_options   s        N)__name__
__module____qualname__r   r   r   r   r	   r	      s#            r   r	   c                   >    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	S )
CommandTestCasec                 J    t                      }t          |          | _        d S r   )r   r	   cmd)r   dists     r   setUpzCommandTestCase.setUp   s    ~~;;r   c                 F   | j         }g d|_        g d|_        t                      |_        d|_        |                    d           |                    d           |                     t          |j        d           |                     t          |j        d           d|_	        |                    d	           | 
                    |j	        dd
g           ddg|_        |                    d           ddg|_        |                     t          |j        d           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"   r    objectr#   r!   ensure_string_listassertRaisesr   r$   assertEqualr(   r)   r   r   s     r   test_ensure_string_listz'CommandTestCase.test_ensure_string_list   sC   h111555%xx#01111222.02C	E 	E 	E 	.02D	F 	F 	F y)))tUm444eny)))Qi.0F#	% 	% 	% 	% 	%r   c                       j         }                     t          |j        dddd            fd}d|_        ||_        |                    dd	dd           d S )
N    funcr   )infilesoutfiler3   argsc                 4                         |d           d S )Nzgenerating out from in)r-   )r3   r6   exec_msglevelr   s       r   _executez0CommandTestCase.test_make_file.<locals>._execute:   s     X'?@@@@@r   Tinout)r   r,   	TypeError	make_fileforceexecute)r   r   r:   s   `  r   test_make_filezCommandTestCase.test_make_file1   s    h 	)S]"#Rf2 	 	G 	G 	G	A 	A 	A 	A 	A	dERHHHHHr   c                     g fd}| j         }||_        d|_        d|_        ddg|_        |                                 g d}|                     |           d S )Nc                 2                         |            d S r   )append)msgr9   msgss     r   	_announcez4CommandTestCase.test_dump_options.<locals>._announceC   s    KKr   r1   )r$   r2   r2   )r(   r2   r2   )zcommand options for 'MyCmd':z  option1 = 1z  option2 = 1)r   announcer$   r(   user_optionsdump_optionsr-   )r   rG   r   wantedrF   s       @r   test_dump_optionsz!CommandTestCase.test_dump_options@   s    	 	 	 	 	h /1DE# # #v&&&&&r   c                    | j         }d|_        |                    d           d |_        |                    dd           |                     t          |d                     d|_        |                     t          |j        d           d S )Nr   r$   r(   r&   r1   r)   )	r   r$   ensure_stringr(   
assertTruehasattrr)   r,   r   r.   s     r   test_ensure_stringz"CommandTestCase.test_ensure_stringP   s    h)$$$)U+++Y//000.0A9MMMMMr   c                     | j         }t          |_        |                    d           d|_        |                     t          |j        d           d S Nr$   r&   r(   )r   __file__r$   ensure_filenamer(   r,   r   r.   s     r   test_ensure_filenamez$CommandTestCase.test_ensure_filename\   sM    hI&&&.0CYOOOOOr   c                     | j         }t          j                            t                    pt          j        |_        |                    d           d|_        | 	                    t          |j        d           d S rS   )r   ospathdirnamerT   curdirr$   ensure_dirnamer(   r,   r   r.   s     r   test_ensure_dirnamez#CommandTestCase.test_ensure_dirnamec   sb    hgooh//<299%%%.0BINNNNNr   c                 H   | j         }t                      5 }|                    d           d d d            n# 1 swxY w Y   |                    d           |                     |                                d           dt          _        	 t                      5 }|                    d           d d d            n# 1 swxY w Y   |                    d           |                     |                                d           dt          _        d S # dt          _        w xY w)Nr&   r   r2   Tzxxx
F)r   r   debug_printseekr-   readr   DEBUG)r   r   stdouts      r   test_debug_printz CommandTestCase.test_debug_printj   sm   h 	#&OOE"""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#A+++	  "" 'f&&&' ' ' ' ' ' ' ' ' ' ' ' ' ' 'KKNNNV[[]]G444EKKK%EKs=   8<<D B=1D =CD CA D D!N)r   r   r   r   r/   rA   rL   rQ   rV   r]   rd   r   r   r   r   r      s          % % %8I I I' ' ' 
N 
N 
NP P PO O O         r   r   __main__)__doc__unittestrX   test.supportr   distutils.cmdr   distutils.distr   distutils.errorsr   	distutilsr   r	   TestCaser   r   mainr   r   r   <module>ro      s       				 ( ( ( ( ( ( ! ! ! ! ! ! ' ' ' ' ' ' 1 1 1 1 1 1          G   i  i  i  i  i h' i  i  i V zHMOOOOO r   