
    Xh
                     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(  xs# ej                  dk  xs ej                  dd d	k(  Zeej                  j                  ed
      d               Zd Zeej                  j                  ed
      d               Zd Zd Zd Zd Zy)z'Tests for two-process terminal frontend    N)check_output)flakycheck_help_all_outputwin32)         )r   
   znot supported)reasonc                      t               \  } }}| j                  d       | j                  d|j                  g|       | j                  d|j                  g|       t	        | ||       y)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      V/var/www/html/myenv/lib/python3.12/site-packages/jupyter_console/tests/test_console.pytest_console_startsr      s[     "OMAwJJsOHH,aH8HHmW[[)1H5GQ    c                      t        d       y)z jupyter console --help-all worksjupyter_consoleNr    r   r   test_help_outputr!      s    +,r   c                      t               \  } }}| j                  d       | j                  d|       | j                  d       | j                  d|       | j                  d|       t        | ||       y)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#   $   sg     "OMAwJJ~HH]AH&JJABHH&H2HH]AH&GQr   c                     | j                          | j                          | j                  |j                  |j                  g|       | j	                         r| j                          yy)z4Stop a running `jupyter console` running via pexpectr   N)sendeofr   r   TIMEOUTisalive	terminater   s      r   r   r   4   sJ     IIKIIKHHgkk7??+QH7yy{	 r   c                  .   ddl } g d}t        j                  }t        j                  j                         }d|d<   d|d<   	 | j                  |||      }d	}j                  d
|       || |fS # t        $ r t        j                  d|z         Y =w xY w)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    8D
..C
**//
C"%C#&C 6MM#DcM2
 	AHH]AH&gq=  6.456s   A0 0!BBc                  B    t               \  } }}| j                  d       y )N )r   r   r   s      r   test_multiprocessingr=   S   s    !OMAwJJrNr   c                  N   t        j                         } 	 t        t        j                  dddgd| i       t
        j                  j                  t
        j                  j                  | d            sJ 	 t        j                  |        y# 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   sw    				Bcnnd,=?RS%r*	
 ww~~bggll2/JK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      s    -
 
  
  #   7 llg%d)9)9E)AdSEUEUVXWXEY]dEd K8  9  -
 K8  9  *
	r   