ó
¼S]c        	   @   s[  d  d l  Z  d  d l Z d  d l m Z d  d l m Z d  d l m Z m Z m	 Z	 d  d l
 m Z d Z d Z d Z d	 Z d
 Z d „  Z e d e d e d e d e ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z d Z d Z d Z e d e d e d e d e ƒ Z d „  Z d „  Z d Z e d e d e d e d e ƒ Z d „  Z  d „  Z! d S(   iÿÿÿÿN(   t   with_directory_contents(   t#   assert_identical_except_blank_lines(   t   ProjectFilet   DEFAULT_PROJECT_FILENAMEt   possible_project_file_names(   t   EnvSpecs8  # This is an Anaconda project file.
#
# Here you can describe your project and how to run it.
# Use `anaconda-project run` to run the project.
# The file is in YAML format, please see http://www.yaml.org/start.html for more.
#

#
# Set the 'name' key to name your project
#
name: <NAME>
#
# Set the 'icon' key to give your project an icon
#
icon:
#
# Set a one-sentence-or-so 'description' key with project details
#
description:
#
# In the commands section, list your runnable scripts, notebooks, and other code.
# Use `anaconda-project add-command` to add commands.
#
commands: {}
#
# In the variables section, list any environment variables your code depends on.
# Use `anaconda-project add-variable` to add variables.
#
variables: {}
#
# In the services section, list any services that should be
# available before your code runs.
# Use `anaconda-project add-service` to add services.
#
services: {}
#
# In the downloads section, list any URLs to download to local files
# before your code runs.
# Use `anaconda-project add-download` to add downloads.
#
downloads: {}
%s%s%s%ss¥   #
# In the packages section, list any packages that must be installed
# before your code runs.
# Use `anaconda-project add-packages` to add packages.
#
packages: []
s—   #
# In the channels section, list any Conda channel URLs to be searched
# for packages.
#
# For example,
#
# channels:
#    - mychannel
#
channels: []
sÖ   #
# In the platforms section, list platforms the project should work on
# Examples: "linux-64", "osx-64", "win-64"
# Use `anaconda-project add-platforms` to add platforms.
#
platforms:
- linux-64
- osx-64
- win-64
s
  #
# You can define multiple, named environment specs.
# Each inherits any global packages or channels,
# but can have its own unique ones also.
# Use `anaconda-project add-env-spec` to add environment specs.
#
env_specs:
  default:
    packages: []
    channels: []
c         C   s   t  |  | | | f S(   N(   t   expected_default_file_template(   t   packagest   channelst	   platformst	   env_specs(    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt   _make_file_contentsg   s    R   R   R	   R
   c          C   s   d „  }  t  t ƒ  |  ƒ d  S(   Nc         S   sã   t  j j |  t ƒ } t  j j | ƒ s. t ‚ t j |  ƒ } | d  k	 sO t ‚ t  j j | ƒ sh t ‚ | j	 ƒ  t  j j | ƒ sŠ t ‚ t
 j | d d ƒ > } | j ƒ  } t j d t  j j |  ƒ ƒ } t | | ƒ Wd  QXd  S(   Nt   rs   utf-8s   <NAME>(   t   ost   patht   joinR   t   existst   AssertionErrorR   t   load_for_directoryt   Nonet   savet   codecst   opent   readt   expected_default_filet   replacet   basenameR   (   t   dirnamet   filenamet   project_filet   filet   contentst   expected(    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt   create_files   s    
(   R    t   dict(   R!   (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt    test_create_missing_project_filer   s    	c            s'   ‡  f d †  } t  i d ˆ  6| ƒ d  S(   Nc            sg   t  j j |  ˆ  ƒ } t  j j | ƒ s- t ‚ t j |  ƒ } | j d d g ƒ } d | k sc t ‚ d  S(   Nt   at   bt   c(   R   R   R   R   R   R   R   t	   get_value(   R   R   R   t   value(   t   relative_name(    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt
   check_file„   s
    s	   a:
  b: c(   R    (   R)   R*   (    (   R)   sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt   _use_existing_project_fileƒ   s    c           C   s   t  t ƒ d  S(   N(   R+   R   (    (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt+   test_use_existing_project_file_default_nameŽ   s    c          C   s   x t  D] }  t |  ƒ q Wd  S(   N(   R   R+   (   t   name(    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt(   test_use_existing_project_file_all_names’   s    c          C   s   d „  }  t  t ƒ  |  ƒ d  S(   Nc         S   s   t  j j |  t ƒ } t  j j | ƒ s. t ‚ t j |  ƒ } | d  k	 sO t ‚ t  j j | ƒ sh t ‚ | j	 d d g ƒ d  k s‰ t ‚ d  S(   NR$   R%   (
   R   R   R   R   R   R   R   R   R   R'   (   R   R   R   (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt   read_missing_file˜   s    (   R    R"   (   R/   (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt(   test_load_directory_without_project_file—   s    	s­   #
# In the packages section, list any packages that must be installed
# before your code runs.
# Use `anaconda-project add-packages` to add packages.
#
packages:
- anaconda
s    #
# In the channels section, list any Conda channel URLs to be searched
# for packages.
#
# For example,
#
# channels:
#    - mychannel
#
channels:
- mychannel
s  #
# You can define multiple, named environment specs.
# Each inherits any global packages or channels,
# but can have its own unique ones also.
# Use `anaconda-project add-env-spec` to add environment specs.
#
env_specs:
  abc:
    description: ABC
    packages: []
    channels: []
c          C   s   d „  }  t  t ƒ  |  ƒ d  S(   Nc         S   sò   d „  } t  j j |  t ƒ } t  j j | ƒ s7 t ‚ t j |  d | ƒ} | d  k	 s^ t ‚ t  j j | ƒ sw t ‚ | j	 ƒ  t  j j | ƒ s™ t ‚ t
 j | d d ƒ > } | j ƒ  } t j d t  j j |  ƒ ƒ } t | | ƒ Wd  QXd  S(   Nc           S   s:   t  d d d d g d g  d d g d d	 d
 d d d ƒ g S(   NR-   t   abct   conda_packagest   anacondat   pip_packagesR   t	   mychannelt   descriptiont   ABCt   inherit_from_namest   inherit_from(    (    (   R   (    (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt   default_env_specs_funcÏ   s    		R:   R   s   utf-8s   <NAME>(   R   R   R   R   R   R   R   R   R   R   R   R   R   t   expected_one_env_spec_contentsR   R   R   (   R   R:   R   R   R   R   R    (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyR!   Î   s    	
(   R    R"   (   R!   (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt5   test_create_missing_project_file_one_default_env_specÍ   s    	c          C   s   d „  }  t  t ƒ  |  ƒ d  S(   Nc         S   s  d „  } t  j j |  t ƒ } t  j j | ƒ s7 t ‚ t j |  d | ƒ} | d  k	 s^ t ‚ t  j j | ƒ sw t ‚ | j	 ƒ  t  j j | ƒ s™ t ‚ | GHt
 j | d d ƒ b } | j ƒ  } | j d d ƒ } t j d d ƒ } | j d t  j j |  ƒ ƒ } t | | ƒ Wd  QXd  S(   Nc           S   s:   t  d d d d g d g  d d g d d	 d
 d d d ƒ g S(   NR-   R1   R2   R3   R4   R   R5   R6   R7   R8   R9   (    (    (   R   (    (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyR:   ì   s    		R:   R   s   utf-8R   t   dependenciess   <NAME>(   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R;   R   R   (   R   R:   R   R   R   R   t#   expected_one_env_spec_contents_depsR    (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyR!   ë   s    	
(   R    R"   (   R!   (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt:   test_create_missing_project_file_one_default_env_spec_depsê   s    	s€  #
# You can define multiple, named environment specs.
# Each inherits any global packages or channels,
# but can have its own unique ones also.
# Use `anaconda-project add-env-spec` to add environment specs.
#
env_specs:
  abc:
    description: ABC
    packages:
    - anaconda
    channels:
    - mychannel
  xyz:
    description: XYZ
    packages:
    - foo
    channels:
    - bar
c          C   s   d „  }  t  t ƒ  |  ƒ d  S(   Nc         S   sò   d „  } t  j j |  t ƒ } t  j j | ƒ s7 t ‚ t j |  d | ƒ} | d  k	 s^ t ‚ t  j j | ƒ sw t ‚ | j	 ƒ  t  j j | ƒ s™ t ‚ t
 j | d d ƒ > } | j ƒ  } t j d t  j j |  ƒ ƒ } t | | ƒ Wd  QXd  S(   Nc           S   sp   t  d d d d g d g  d d g d d	 d
 d d d ƒ t  d d d d g d g  d d g d d d
 d d d ƒ g S(   NR-   R1   R2   R3   R4   R   R5   R6   R7   R8   R9   t   xyzt   foot   bart   XYZ(    (    (    (    (   R   (    (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyR:   (  s     				R:   R   s   utf-8s   <NAME>(   R   R   R   R   R   R   R   R   R   R   R   R   R   t   expected_two_env_spec_contentsR   R   R   (   R   R:   R   R   R   R   R    (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyR!   '  s    	
(   R    R"   (   R!   (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt6   test_create_missing_project_file_two_default_env_specs&  s    	!c          C   s   d „  }  t  t ƒ  |  ƒ d  S(   Nc         S   s  d „  } t  j j |  t ƒ } t  j j | ƒ s7 t ‚ t j |  d | ƒ} | d  k	 s^ t ‚ t  j j | ƒ sw t ‚ | j	 ƒ  t  j j | ƒ s™ t ‚ t
 j | d d ƒ b } | j ƒ  } | j d d ƒ } t j d d ƒ } | j d t  j j |  ƒ ƒ } t | | ƒ Wd  QXd  S(   Nc           S   sp   t  d d d d g d g  d d g d d	 d
 d d d ƒ t  d d d d g d g  d d g d d d
 d d d ƒ g S(   NR-   R1   R2   R3   R4   R   R5   R6   R7   R8   R9   R@   RA   RB   RC   (    (    (    (    (   R   (    (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyR:   M  s     				R:   R   s   utf-8R   R=   s   <NAME>(   R   R   R   R   R   R   R   R   R   R   R   R   R   R   RD   R   R   (   R   R:   R   R   R   R   t#   expected_two_env_spec_contents_depsR    (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyR!   L  s    	
(   R    R"   (   R!   (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt;   test_create_missing_project_file_two_default_env_specs_depsK  s    	#("   R   R   t,   anaconda_project.internal.test.tmpfile_utilsR    t#   anaconda_project.test.project_utilsR   t   anaconda_project.project_fileR   R   R   t   anaconda_project.env_specR   R   t   empty_global_packagest   empty_global_channelst   default_global_platformst   empty_default_env_specsR   R   R#   R+   R,   R.   R0   t   anaconda_global_packagest   mychannel_global_channelst   abc_empty_env_specR;   R<   R?   t   abc_xyz_env_specsRD   RE   RG   (    (    (    sF   lib/python2.7/site-packages/anaconda_project/test/test_project_file.pyt   <module>   sN   +										3		%