U
    2ÜŸj¢  ã                   @   sŽ   d Z ddlZddlZddlZddlmZ dZzddlm	Z	 ddl
mZ W n ek
r`   dZY nX ejdd… dkrxd	ZG d
d„ dejƒZdS )z
Test win32 shortcut script
é    N)Úunittest)Úshell)Úshortcutz"Only runs on Windows with win32comé   )é   é   zBroken on Python 3.7+.c                   @   s,   e Zd ZeZddœdd„Zddœdd„ZdS )ÚShortcutTestsN)Úreturnc                 C   s‚   t }tj |¡}t |¡}|  ¡ d }| |¡ |  tj 	|¡¡ t 
|¡}| tj¡d }|  |t|ƒ d…  ¡ | ¡ ¡ dS )z+
        Create a simple shortcut.
        ú.lnkr   N)Ú__file__ÚosÚpathÚbasenamer   ÚShortcutÚmktempÚsaveÚ
assertTrueÚexistsÚopenÚGetPathr   ÚSLGP_RAWPATHÚassertEqualÚlenÚlower)ÚselfÚtestFilenameÚbaseFileNameÚs1ÚtempnameÚscÚscPath© r!   ú>/tmp/pip-unpacked-wheel-4b529toj/twisted/test/test_shortcut.pyÚtest_create   s    


zShortcutTests.test_createc                 C   sÌ   t j}tj |¡}t ¡ }tj|dd||dd�}|  	¡ d }| 
|¡ |  tj |¡¡ t |¡}| tj¡d }|  |t|ƒ d…  ¡ | ¡ ¡ |  | ¡ d¡ |  | ¡ |¡ |  | ¡ |df¡ dS )zZ
        Create a shortcut to the Python executable,
        and set some values.
        z-VzThe Python executableé   )r   Ú	argumentsÚdescriptionZ
workingdirZiconpathZiconidxr
   r   N)ÚsysÚ
executabler   r   r   ÚtempfileÚ
gettempdirr   r   r   r   r   r   r   r   r   r   r   r   r   ZGetDescriptionZGetWorkingDirectoryZGetIconLocation)r   r   r   ZtempDirr   r   r   r    r!   r!   r"   Útest_createPythonShortcut(   s(    ú

"z'ShortcutTests.test_createPythonShortcut)Ú__name__Ú
__module__Ú__qualname__Ú
skipReasonÚskipr#   r+   r!   r!   r!   r"   r      s   r   )Ú__doc__Úos.pathr   r'   r)   Ztwisted.trialr   r/   Úwin32com.shellr   Ztwisted.pythonr   ÚImportErrorÚversion_infoZTestCaser   r!   r!   r!   r"   Ú<module>   s   
