B
    nb\                 @   s   d Z ddlZddlZyddlmZ W n  ek
rD   ddlmZ Y nX ddlZddlm	Z	 ddl
mZ ddlmZ ddlmZmZ ejdd	 Zejd
d ZdS )z+
Testing utilities to be used with pytest.
    N)Mock)EditorStack)FindReplace)
UserConfig)CONF_VERSIONDEFAULTSc                s4   t   tdtt dd} fdd}| | |S )z9
    Fixtures that returns a temporary CONF element.
    zspyder-testT)defaultsversionZ	subfolderZraw_modec                  s   t   dS )zI
        Fixture finalizer to delete the temporary CONF element.
        N)shutilZrmtree )	SUBFOLDERr   4lib/python3.7/site-packages/spyder/utils/fixtures.pyfin*   s    ztmpconfig.<locals>.fin)tempfileZmkdtempr   r   r   Zaddfinalizer)ZrequestZCONFr   r   )r   r   	tmpconfig   s    
r   c             C   sb   d}t dg }|t  |t| |t t t t  |dd|}| | ||jfS )z
    Set up EditorStack with CodeEditor containing some Python code.
    The cursor is at the empty line below the code.
    Returns tuple with EditorStack and CodeEditor.
    za = 1
print(a)

x = 2Nzfoo.pyzutf-8)	r   Zset_introspectorr   Zset_find_widgetr   Zset_io_actionsnewZ	addWidgetZeditor)ZqtbottextZeditorStackZfinfor   r   r   setup_editor3   s    

r   )__doc__r
   r   Zunittest.mockr   ImportErrorZmockZpytestZspyder.widgets.editorr   Zspyder.widgets.findreplacer   Zspyder.config.userr   Zspyder.config.mainr   r   Zfixturer   r   r   r   r   r   <module>	   s   