o
    gA
                     @   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r>e
e  dS 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Z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   Z/Users/admin/.pyenv/versions/3.10.0/lib/python3.10/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	|} D ]}| 
|| qJd S )Nc                    sB     |  ttj| d}z|| W |  d S |  w )Nw)appendopenospathjoinwriteclose)nametextfZ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   )mkdtempr   r   r   r   r   r   runr   listdirZassertIn)r   r$   targetr   r   Z	installedr   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    A