B
    Üö›\A
  ã               @   s|   d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 G dd„ dejejejƒZd	d
„ Zedkrxe
eƒ ƒ dS )z,Tests for distutils.command.install_scripts.é    N)Úinstall_scripts)ÚDistribution)Úsupport)Úrun_unittestc               @   s   e Zd Zdd„ Zdd„ ZdS )ÚInstallScriptsTestCasec             C   s¦   t ƒ }tjdd|jd< tjdddd|jd< t|ƒ}|  |j¡ |  |j¡ |  |j	¡ |  |j
¡ | ¡  |  |j¡ |  |j¡ |  |j	d¡ |  |j
d¡ d S )Nz/foo/bar)Úbuild_scriptsÚbuildz/splat/funké   )r   ÚforceÚ
skip_buildÚinstall)r   r   ÚDummyCommandÚcommand_objr   ZassertFalser
   r   ZassertIsNoneZ	build_dirZinstall_dirÚfinalize_optionsZ
assertTrueZassertEqual)ÚselfÚdistÚcmd© r   ú5lib/python3.7/distutils/tests/test_install_scripts.pyÚtest_default_settings   s"    z,InstallScriptsTestCase.test_default_settingsc                s®   |   ¡ ‰g ‰ ‡ ‡fdd„}|ddƒ |ddƒ |ddƒ |   ¡ }tƒ }tjˆd	|jd
< tj|ddd|jd< t|ƒ}| ¡  | ¡  t 	|¡}xˆ D ]}|  
||¡ q–W d S )Nc                s<   ˆ   | ¡ ttj ˆ| ¡dƒ}z| |¡ W d | ¡  X d S )NÚw)ÚappendÚopenÚosÚpathÚjoinÚwriteÚclose)ÚnameÚtextÚf)ÚexpectedÚsourcer   r   Úwrite_script+   s
    
z>InstallScriptsTestCase.test_installation.<locals>.write_scriptz
script1.pyz@#! /usr/bin/env python2.3
# bogus script w/ Python sh-bang
pass
z
script2.pyz8#!/usr/bin/python
# bogus script w/ Python sh-bang
pass
zshell.shz1#!/bin/sh
# bogus shell script w/ sh-bang
exit 0
)r   r   r	   )r   r
   r   r   )Zmkdtempr   r   r   r   r   r   Úrunr   ÚlistdirZassertIn)r   r#   Útargetr   r   Z	installedr   r   )r!   r"   r   Útest_installation'   s&    




z(InstallScriptsTestCase.test_installationN)Ú__name__Ú
__module__Ú__qualname__r   r'   r   r   r   r   r      s   r   c               C   s
   t  t¡S )N)ÚunittestZ	makeSuiter   r   r   r   r   Ú
test_suiteN   s    r,   Ú__main__)Ú__doc__r   r+   Z!distutils.command.install_scriptsr   Zdistutils.corer   Zdistutils.testsr   Ztest.supportr   ZTempdirManagerZLoggingSilencerZTestCaser   r,   r(   r   r   r   r   Ú<module>   s   ?