ó
˛,]c           @   s   d  Z  d d l Z d d l j Z d d l m Z d d l m Z m	 Z	 m
 Z
 m Z e j d d  d    Z d   Z d	   Z e d
 k r e j   n  d S(   s   
Tests for __init__.py.
i˙˙˙˙N(   t   EmptyProject(   t	   CODESTYLEt	   WORKSPACEt   ENCODINGt   VCSt   scopet   sessionc         C   s+   |  j  d  } t t |   } | | f S(   s   
    Fixture for create a temporary project.

    Returns:
        project_dir: fixture of temporary project dir.
        project: EmptyProject object.
    t   test_project(   t   mktempR    t   str(   t   tmpdir_factoryt   project_dirt   project(    (    sI   lib/python2.7/site-packages/spyder/widgets/projects/tests/test_project.pyt   project_test   s    	c         C   s   |  \ } } | j  t |  k s' t  | j   } xQ t t t t g D]= } | | k s^ t  | | } t j	 | j
    sF t  qF Wd S(   s=   Test creation of anEmpy project, and its configuration files.N(   t	   root_pathR	   t   AssertionErrort   get_conf_filesR   R   R   R   t   ospt   existst   filename(   R   R   R   t
   conf_filest   dir_t   project_config(    (    sI   lib/python2.7/site-packages/spyder/widgets/projects/tests/test_project.pyt   test_empty_project#   s    
c         C   sŢ   |  \ } } g  } xF d d d g D]5 } | j  |  } | j d  | j t |   q" W| j |  | j   | k s t  | | d g } t |  t |  d k s´ t  | j |  | j   | k sÚ t  d S(   s   Test saving and loading files from the configuration.

    Saving/loading should preserved the order, and remove duplicates.
    s   a.pys   b.pys   c.pys   # Some dummy contenti    i   N(   t   joint   writet   appendR	   t   set_recent_filest   get_recent_filesR   t   len(   R   R   R   t   files_pathst   ft   file_t   files_paths_duplicate(    (    sI   lib/python2.7/site-packages/spyder/widgets/projects/tests/test_project.pyt   test_set_load_recent_files2   s    "t   __main__(   t   __doc__t   pytestt   os.patht   pathR   t   spyder.widgets.projectsR    t   spyder.widgets.projects.configR   R   R   R   t   fixtureR   R   R"   t   __name__t   main(    (    (    sI   lib/python2.7/site-packages/spyder/widgets/projects/tests/test_project.pyt   <module>   s   "		