U
    1et                     @   s<   d Z ddlZddlmZ ddlmZ ddlmZ dd ZdS )zTest installing editor hooks    N)mock)get_ipython)editorhooksc               	      s   g   fdd} t jddd td|  t jdd W 5 Q R X t d	ksVt d
 d } d
 d }|ddiks~tt	j
drdddddg}nd}|d
 }||kstd S )Nc                     s      | |d tjf ddiS )Nargskwargszwait.return_valuer   )appendr   Z	MagicMockr   called F/tmp/pip-unpacked-wheel-3hxk2k58/IPython/lib/tests/test_editorhooks.py
fake_popen
   s
    z'test_install_editor.<locals>.fake_popenzfoo -l {line} -f {filename}F)waitzsubprocess.Popenzthe file@      r   r   r   shellTwinZfooz-lZ64z-fzfoo -l 64 -f 'the file')r   Zinstall_editorr   patchr   hooksZeditorlenAssertionErrorsysplatform
startswith)r   r   r   expectedcmdr   r	   r   test_install_editor   s    r   )	__doc__r   Zunittestr   ZIPythonr   ZIPython.libr   r   r   r   r   r   <module>   s
   