
    c
                     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 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 )    N)join)minimal_environ)project_no_dedicated_env)prepare_without_interaction)/with_directory_contents_completing_project_file)DEFAULT_PROJECT_FILENAME)project)CommandTemplateArgsTransformerTemplatec                     i dt          t          j        d          sJ fd G d dt                     G fddt                    fdfd	}t          t          d
ddi|           d S )Nz
custom-cmdget_pluginsc                     diS )Nvalid_package_plugin )cmd_typeplugin_init_mocks    Blib/python3.11/site-packages/anaconda_project/test/test_plugins.pyget_plugins_mockz5test_prepare_plugin_command.<locals>.get_plugins_mock   s    &(899    c                       e Zd Zd ZdS )4test_prepare_plugin_command.<locals>.TestTransformerc                     dgS )N--showr   )selfresultsargss      r   add_argsz=test_prepare_plugin_command.<locals>.TestTransformer.add_args   s
    :r   N)__name__
__module____qualname__r   r   r   r   TestTransformerr      s#        	 	 	 	 	r   r!   c                        e Zd Z ZZddZdS ),test_prepare_plugin_command.<locals>.TestCmdNc                 j    |t          |t                    sJ d}| j        dd| j        z  g}||z   |fS )NFcustom-sub-cmd--%s.TESTARG)
isinstancelistcommand_with_conda_prefixcommand)r   environ
extra_argsshellr   s        r   choose_args_and_shellzBtest_prepare_plugin_command.<locals>.TestCmd.choose_args_and_shell%   sK    EJ)E)EEEEE24DnW[WcFcdD*$e++r   )N)r   r   r    args_transformer_clsr*   r.   )r!   cmd_names   r   TestCmdr#   !   s4        .	, 	, 	, 	, 	, 	,r   r1   c                  (    | d<   |d<    | i |S )Nr   kwsr   )r   r3   r1   called_withs     r   r   z5test_prepare_plugin_command.<locals>.plugin_init_mock-   s,    "F Ew$$$$r   c                 "   t           j        _        t          |           }t	                      }t          ||d          }t          t          j        d         d          }|ddz  dg}|j	        g k    sJ |sJ |j
        j        |k    sJ d S )Nfoo)r+   command_nameCONDA_PREFIXbinr%   r&   r   )r	   plugins_apir   r   r   r   r   osr+   errorscommand_exec_infor   )dirname_projectr+   resultcmd_pathexpectedr0   r   s         r   checkz*test_prepare_plugin_command.<locals>.check2   s     +;'+G44!##,XwUZ[[[
>2E8DD.0I8T}""""',888888r   zO
commands:
    foo:
       valid_package_plugin: foo.py
packages:
  - notebook
zfoo.pyz# foo)hasattrr	   r:   r   r
   r   r   )	monkeypatchtmpdirrC   r1   r!   r4   r0   r   r   s	      @@@@@@r   test_prepare_plugin_commandrG      s   KH7&66666: : : : :    1   
, 
, 
, 
, 
, 
, 
, 
,/ 
, 
, 
,% % % % % %
9 9 9 9 9 9  4$ ' g		
 
 
 
 
 
r   )r;   os.pathr   #anaconda_project.test.environ_utilsr   #anaconda_project.test.project_utilsr   anaconda_project.preparer   ,anaconda_project.internal.test.tmpfile_utilsr   anaconda_project.project_filer   anaconda_projectr	   anaconda_project.pluginsr
   r   rG   r   r   r   <module>rP      s    
			       ? ? ? ? ? ? H H H H H H B B B B B B j j j j j j B B B B B B $ $ $ $ $ $ M M M M M M M M7 7 7 7 7r   