
    }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
 e
j                  d        Ze
j                  d        Zd	 Zy)
z"Tests for IPython.core.application    N)TemporaryDirectory)Unicode)BaseIPythonApplication)
decoratorsc                  Z   t        j                  d      } t        j                         }t        j                  |        	 t               }|j                          |j                          |j                  d       t        j                  |       y# t        j                  |       w xY w)z@Check that IPython starts with non-ascii characters in the path.   €suffixFsuppress_errorsN)	tempfilemkdtemposgetcwdchdirr   init_profile_dirinit_config_filesload_config_file)wdold_wdapps      E/usr/lib/python3/dist-packages/IPython/core/tests/test_application.pytest_unicode_cwdr      sy     
			(BYY[FHHRL$&U3
s   <B B*c                     t        j                  d      } t        t        j                  j                  | d      dd      5 }	 ddd       t        j                  j                  dd      }t        j                  j                  d	d      }| t        j                  d<   	 t               }|j                          |j                          |j                  d
       |r|t        j                  d<   |r|t        j                  d<   yy# 1 sw Y   xY w# |r|t        j                  d<   |r|t        j                  d<   w w xY w)zBCheck that IPython starts with non-ascii characters in the IP dir.r   r	   ipython_config.pywutf-8encodingN
IPYTHONDIRIPYTHON_DIRFr   )r   r   openr   pathjoinenvironpopr   r   r   r   )ipdirf
old_ipdir1
old_ipdir2r   s        r   test_unicode_ipdirr+      s    F+E 
bggll5"56g	N RS d3Jt4J$BJJ|
2$&U3'1BJJ|$'1BJJ|$   '1BJJ|$'1BJJ|$ s   D	!<D 	D-Ec                     t               5 }  G d dt              }t        t        j                  j                  | d      dd      5 }|j                  d       d d d         |       }|j                  d| g       |j                  d	k(  sJ  |       }|j                  d| d
g       |j                  dk(  sJ 	 d d d        y # 1 sw Y   jxY w# 1 sw Y   y xY w)Nc                   :    e Zd Z e       j	                  d      Zy)"test_cli_priority.<locals>.TestAppT)configN)__name__
__module____qualname__r   tagtest     r   TestAppr.   :   s    9===-Dr6   r7   r   r   r   r   zc.TestApp.test = 'config file'z--profile-dirzconfig filez--TestApp.test=clicli)	r   r   r"   r   r#   r$   write
initializer4   )tdr7   r(   r   s       r   test_cli_priorityr<   7   s    		 !	., 	. "'',,r#67wO 	6STGG45	6 i,-xx=(((i-ABCxx5   ! !	6 	6! !s$   <CCACC	CC)__doc__r   r   r   	traitletsr   IPython.core.applicationr   IPython.testingr   deconlyif_unicode_pathsr   r+   r<   r5   r6   r   <module>rC      sS    ( 	  '  ; -    2 2.!r6   