aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/test/test_shortcut.py
blob: fdcb77537ccd673302373af1155ef73774293e5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Test win32 shortcut script
"""

from twisted.trial import unittest

import os
if os.name == 'nt':

    skipWindowsNopywin32 = None
    try:
        from twisted.python import shortcut
    except ImportError:
        skipWindowsNopywin32 = ("On windows, twisted.python.shortcut is not "
                                "available in the absence of win32com.")
    import os.path
    import sys

    class ShortcutTest(unittest.TestCase):
        def testCreate(self):
            s1=shortcut.Shortcut("test_shortcut.py")
            tempname=self.mktemp() + '.lnk'
            s1.save(tempname)
            self.assert_(os.path.exists(tempname))
            sc=shortcut.open(tempname)
            self.assert_(sc.GetPath(0)[0].endswith('test_shortcut.py'))
    ShortcutTest.skip = skipWindowsNopywin32