~ntt-pf-lab/nova/monkey_patch_notification

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/twisted/test/test_shortcut.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""Test win32 shortcut script
 
2
"""
 
3
 
 
4
from twisted.trial import unittest
 
5
 
 
6
import os
 
7
if os.name == 'nt':
 
8
 
 
9
    skipWindowsNopywin32 = None
 
10
    try:
 
11
        from twisted.python import shortcut
 
12
    except ImportError:
 
13
        skipWindowsNopywin32 = ("On windows, twisted.python.shortcut is not "
 
14
                                "available in the absence of win32com.")
 
15
    import os.path
 
16
    import sys
 
17
 
 
18
    class ShortcutTest(unittest.TestCase):
 
19
        def testCreate(self):
 
20
            s1=shortcut.Shortcut("test_shortcut.py")
 
21
            tempname=self.mktemp() + '.lnk'
 
22
            s1.save(tempname)
 
23
            self.assert_(os.path.exists(tempname))
 
24
            sc=shortcut.open(tempname)
 
25
            self.assert_(sc.GetPath(0)[0].endswith('test_shortcut.py'))
 
26
    ShortcutTest.skip = skipWindowsNopywin32