
    "d
                     z   d Z 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Zddl	m
Z
 ej        dk    pej        dk     pej        dd         d	k    Zeej                            ed
          d                         Zd Zeej                            ed
          d                         Zd Zd Zd Zd ZdS )z'Tests for two-process terminal frontend    N)check_output)flakycheck_help_all_outputwin32)         )r   
   znot supported)reasonc                      t                      \  } }}|                     d           |                     d|j        g|           |                     d|j        g|           t	          | ||           dS )z-test that `jupyter console` starts a terminal5zOut\[\d+\]: 5timeout
In \[\d+\]N)start_consolesendlineexpectEOFstop_consoleppexpectts      Blib/python3.11/site-packages/jupyter_console/tests/test_console.pytest_console_startsr      su     "OOMAwJJsOOOHH,aH888HHmW[)1H555GQ    c                  $    t          d           dS )z jupyter console --help-all worksjupyter_consoleNr    r   r   test_help_outputr!      s    +,,,,,r   c                  *   t                      \  } }}|                     d           |                     d|           |                     d           |                     d|           |                     d|           t          | ||           dS )z3Ensure display protocol plain/text key is supportedzx = %lsmagicr   r   z0from IPython.display import display; display(x);zAvailable line magics:N)r   r   r   r   r   s      r   test_display_textr#   $   s     "OOMAwJJ~HH]AH&&&JJABBBHH&H222HH]AH&&&GQr   c                     |                                   |                                   |                     |j        |j        g|           |                                 r|                                  dS dS )z4Stop a running `jupyter console` running via pexpectr   N)sendeofr   r   TIMEOUTisalive	terminater   s      r   r   r   4   sh     IIKKKIIKKKHHgk7?+QH777yy{{ 	 r   c                  8   ddl } g d}t          j        }t          j                                        }d|d<   d|d<   	 |                     |||          }n'# t          $ r t          j	        d|z             Y nw xY wd	}|
                    d
|           || |fS )z%Start `jupyter console` using pexpectr   N)-mr   z--colors=NoColor1JUPYTER_CONSOLE_TESTPROMPT_TOOLKIT_NO_CPR)argsenvzCouldn't find command %sx   r   r   )r   sys
executableosenvironcopyspawnIOErrorpytestskipr   )r   r.   cmdr/   r   r   s         r   r   r   >   s    NNN888D
.C
*//

C"%C#&C 6MM#DcM22 6 6 6.4555556 	AHH]AH&&&gq=s   A !A;:A;c                  T    t                      \  } }}|                     d           d S )N )r   r   r   s      r   test_multiprocessingr=   S   s$    !OOMAwJJrNNNNNr   c                  J   t          j                    } 	 t          t          j        dddgd| i           t
          j                            t
          j                            | d                    sJ 	 t          j
        |            dS # t          j
        |            w xY w)z'jupyter console --generate-config worksr*   r   z--generate-configJUPYTER_CONFIG_DIR)r/   zjupyter_console_config.pyN)tempfilemkdtempr   r1   r2   r3   pathisfilejoinshutilrmtree)tds    r   test_generate_configrH   X   s    				Bcnd,=?RS%r*	
 	
 	
 	
 w~~bgll2/JKKLLLLLLbbs   A B B")__doc__r3   rE   r1   r@   
subprocessr   r   r8   traitlets.tests.utilsr   platformversion_infoshould_skipmarkskipifr   r!   r#   r   r   r=   rH   r    r   r   <module>rQ      sp   - -
 
			  



  # # # # # #        7 7 7 7 7 7 lg%d)9E)AdSEUVXWXVXEY]dEd K88    98  - - -
 K88    98      *  
	 	 	 	 	r   