o
    ¯bª  ã                   @   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y/   dZY nw ejdd… dkr;d	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„ Zdd„ ZdS )ÚShortcutTestsc                 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    ú</usr/lib/python3/dist-packages/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ÚdescriptionÚ
workingdirÚiconpathÚiconidxr	   r   N)ÚsysÚ
executabler   r   r   ÚtempfileÚ
gettempdirr   r   r   r   r   r   r   r   r   r   r   r   r   ÚGetDescriptionÚGetWorkingDirectoryÚGetIconLocation)r   r   r   ÚtempDirr   r   r   r   r    r    r!   Útest_createPythonShortcut(   s(   ú

"z'ShortcutTests.test_createPythonShortcutN)Ú__name__Ú
__module__Ú__qualname__Ú
skipReasonÚskipr"   r1   r    r    r    r!   r      s    r   )Ú__doc__Úos.pathr   r)   r+   Útwisted.trialr   r5   Úwin32com.shellr   Útwisted.pythonr   ÚImportErrorÚversion_infoÚTestCaser   r    r    r    r!   Ú<module>   s    ÿ