
    Mh                     f    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  G d d	e          ZdS )
zTest yarn registry replacement    N)join)patch)commands   )AppHandlerTestc                   ,    e Zd Zd Zd Zd Zd Zd ZdS )TestAppHandlerRegistryc                 *   t          d          5 }t          d          |_        t          j        d          }t          j        |          }|                    d           |                     |i i d           d d d            d S # 1 swxY w Y   d S )Nzjupyterlab.commands.whichzCommand not found
jupyterlabnodezyarn configz
npm config)	r   
ValueErrorside_effectlogging	getLoggerr   _yarn_configassert_called_once_withassertDictEqual)selfwhichloggerconfigs       ^/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/jupyterlab/tests/test_registry.pytest_node_not_availablez.TestAppHandlerRegistry.test_node_not_available   s     .// 	P5 *+> ? ?E&|44F*622F))&111  2)N)NOOO	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	Ps   A+BBBc                 p   t          d          5 }d}d                    ddt          |d          z   dz   ddt          |d          z   dz   g          |_        t	          j        d	          }t          j        |          }|                     |d
|id
|id           d d d            d S # 1 swxY w Y   d S )Nsubprocess.check_outputhttps://private.yarn/manager   
$   {"type":"info","data":"yarn config"}&   {"type":"inspect","data":{"registry":"utf-8   "}}#   {"type":"info","data":"npm config"}r   registryr   )	r   r   bytesreturn_valuer   r   r   r   r   )r   check_outputyarn_registryr   r   s        r   test_yarn_configz'TestAppHandlerRegistry.test_yarn_config   s+   ,-- 	:M(-

;=M7334 ;=M7334	) )L% &|44F*622F  $.#>#-}"=   #	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   BB++B/2B/c                    t          d          5 }t          j        dg ddd          |_        t	          j        d          }t          j        |          }|                     |i i d           d d d            d S # 1 swxY w Y   d S )	Nr   r   )yarnr   list    s   yarn config failed.)stderrr   r   )	r   
subprocessCalledProcessErrorr   r   r   r   r   r   )r   r'   r   r   s       r   test_yarn_config_failurez/TestAppHandlerRegistry.test_yarn_config_failure7   s    ,-- 	P'1'D---s;Q( ( (L$ &|44F*622F  2)N)NOOO	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	Ps   A!A>>BBc                 B   t          d          5 }d}d                    ddt          |d          z   dz   ddt          |d          z   dz   g          |_        t	          j                    }|                     |j        |           d d d            d S # 1 swxY w Y   d S )	Nr   r   r   r   r    r!   r"   r#   )r   r   r%   r&   r   
AppOptionsassertEqualr$   )r   r'   r(   handlers       r   test_get_registryz(TestAppHandlerRegistry.test_get_registryB   s    ,-- 	>:M(-

;=M7334 ;=M7334	) )L% )++GW-}===#	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>s   A7BBBc                    t          d          5 }d}d                    ddt          |d          z   dz   ddt          |d          z   dz   g          |_        t	          | j        d	          }t          j        t          j                              }|	                                 t	          |d
          }t          |          5 }|                                }d d d            n# 1 swxY w Y   |                     t          j        |           |                     ||           d d d            d S # 1 swxY w Y   d S )Nr   r   r   r   r    r!   r"   r#   stagingz	yarn.lock)r   r   r%   r&   pjoinapp_dirr   _AppHandlerr3   _populate_stagingopenreadassertNotInYARN_DEFAULT_REGISTRY)r   r'   r(   r8   r5   	lock_pathflocks           r   test_populate_stagingz,TestAppHandlerRegistry.test_populate_stagingV   s   ,-- 	2:M(-

;=M7334 ;=M7334	) )L% DL)44G*8+>+@+@AAG%%'''g{33Ii  Avvxx                              X;TBBB]D1113	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2s6   B6D5C'D5'C+	+D5.C+	/9D55D9<D9N)__name__
__module____qualname__r   r)   r1   r6   rD    r-   r   r	   r	      se        
P 
P 
P  4	P 	P 	P> > >(2 2 2 2 2r-   r	   )__doc__r   r/   os.pathr   r9   unittest.mockr   r   r   test_jupyterlabr   r	   rH   r-   r   <module>rM      s    $ $
      ! ! ! ! ! !             + + + + + +`2 `2 `2 `2 `2^ `2 `2 `2 `2 `2r-   