ó
žS]c           @   s   d  d l  Z  d  d l m Z d  d l m Z d  d l m Z d  d l m Z d  d l	 m
 Z
 d  d l m Z d  d l m Z d  d	 l m Z m Z d
   Z d S(   iĸĸĸĸN(   t   join(   t   minimal_environ(   t   project_no_dedicated_env(   t   prepare_without_interaction(   t/   with_directory_contents_completing_project_file(   t   DEFAULT_PROJECT_FILENAME(   t   project(   t   CommandTemplatet   ArgsTransformerTemplatec            sŦ   i   d  t  t j d  s$ t   f d    d t f d     Y d t f   f d     Y     f d      f d	   } t i d
 t 6d d 6|  d  S(   Ns
   custom-cmdt   get_pluginsc            s   i   d 6S(   Nt   valid_package_plugin(    (   t   cmd_type(   t   plugin_init_mock(    sA   lib/python2.7/site-packages/anaconda_project/test/test_plugins.pyt   get_plugins_mock   s    t   TestTransformerc           B   s   e  Z d    Z RS(   c         S   s   d g S(   Ns   --show(    (   t   selft   resultst   args(    (    sA   lib/python2.7/site-packages/anaconda_project/test/test_plugins.pyt   add_args   s    (   t   __name__t
   __module__R   (    (    (    sA   lib/python2.7/site-packages/anaconda_project/test/test_plugins.pyR      s   t   TestCmdc              s    e  Z   Z  Z d d   Z RS(   c         S   sN   | d  k s! t | t  s! t  t } |  j d d |  j g } | | | f S(   Ns   custom-sub-cmds   --%s.TESTARG(   t   Nonet
   isinstancet   listt   AssertionErrort   Falset   command_with_conda_prefixt   command(   R   t   environt
   extra_argst   shellR   (    (    sA   lib/python2.7/site-packages/anaconda_project/test/test_plugins.pyt   choose_args_and_shell%   s    !N(   R   R   t   args_transformer_clsR   R   R    (    (   R   t   cmd_name(    sA   lib/python2.7/site-packages/anaconda_project/test/test_plugins.pyR   !   s   c             s!   |   d <|  d <  |  |   S(   NR   t   kws(    (   R   R#   (   R   t   called_with(    sA   lib/python2.7/site-packages/anaconda_project/test/test_plugins.pyR   -   s    

c            sĨ    t  j _ t |   } t   } t | d | d d } t t j d d    } | d d   d g } | j	 g  k s} t
  | s t
  | j j | k sĄ t
  d  S(	   NR   t   command_namet   foot   CONDA_PREFIXt   bins   custom-sub-cmds   --%s.TESTARGs   --show(   R   t   plugins_apiR	   R   R   R   R    t   osR   t   errorsR   t   command_exec_infoR   (   t   dirnamet   _projectR   t   resultt   cmd_patht   expected(   R"   R   (    sA   lib/python2.7/site-packages/anaconda_project/test/test_plugins.pyt   check2   s    	sO   
commands:
    foo:
       valid_package_plugin: foo.py
packages:
  - notebook
s   # foos   foo.py(   t   hasattrR   R)   R   R   R   R   R   (   t   monkeypatcht   tmpdirR2   (    (   R   R   R$   R"   R   R   sA   lib/python2.7/site-packages/anaconda_project/test/test_plugins.pyt   test_prepare_plugin_command   s    (   R*   t   os.pathR    t#   anaconda_project.test.environ_utilsR   t#   anaconda_project.test.project_utilsR   t   anaconda_project.prepareR   t,   anaconda_project.internal.test.tmpfile_utilsR   t   anaconda_project.project_fileR   t   anaconda_projectR   t   anaconda_project.pluginsR   R   R6   (    (    (    sA   lib/python2.7/site-packages/anaconda_project/test/test_plugins.pyt   <module>   s   