ó
‹²,]c           @   sÐ   d  Z  d d l Z d d l Z y d d l m Z Wn! e k
 rU d d l m Z n Xd 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 „  ƒ Z e j d	 „  ƒ Z d S(
   s+   
Testing utilities to be used with pytest.
iÿÿÿÿN(   t   Mock(   t   EditorStack(   t   FindReplace(   t
   UserConfig(   t   CONF_VERSIONt   DEFAULTSc      
      sP   t  j ƒ  ‰  t d d t d t d ˆ  d t ƒ} ‡  f d †  } |  j | ƒ | S(   s9   
    Fixtures that returns a temporary CONF element.
    s   spyder-testt   defaultst   versiont	   subfoldert   raw_modec              s   t  j ˆ  ƒ d S(   sI   
        Fixture finalizer to delete the temporary CONF element.
        N(   t   shutilt   rmtree(    (   t	   SUBFOLDER(    s4   lib/python2.7/site-packages/spyder/utils/fixtures.pyt   fin*   s    (   t   tempfilet   mkdtempR   R   R   t   Truet   addfinalizer(   t   requestt   CONFR   (    (   R   s4   lib/python2.7/site-packages/spyder/utils/fixtures.pyt	   tmpconfig   s    		c         C   s‰   d } t  d g  ƒ } | j t ƒ  ƒ | j t | ƒ ƒ | j t ƒ  t ƒ  t ƒ  t ƒ  ƒ | j d d | ƒ } |  j | ƒ | | j	 f S(   s°   
    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.
    s   a = 1
print(a)

x = 2s   foo.pys   utf-8N(
   R   t   Nonet   set_introspectorR    t   set_find_widgetR   t   set_io_actionst   newt	   addWidgett   editor(   t   qtbott   textt   editorStackt   finfo(    (    s4   lib/python2.7/site-packages/spyder/utils/fixtures.pyt   setup_editor3   s    "(   t   __doc__R
   R   t   unittest.mockR    t   ImportErrort   mockt   pytestt   spyder.widgets.editorR   t   spyder.widgets.findreplaceR   t   spyder.config.userR   t   spyder.config.mainR   R   t   fixtureR   R    (    (    (    s4   lib/python2.7/site-packages/spyder/utils/fixtures.pyt   <module>	   s   