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    