Ticket #3707: test_lockfile-win32.diff

File test_lockfile-win32.diff, 1.0 KB (added by christianmlong, 13 years ago)
  • test_lockfile.py

     
    1212from twisted.python import lockfile
    1313from twisted.python.runtime import platform
    1414
     15try:
     16    from win32api import OpenProcess
     17    import pywintypes
     18except ImportError:
     19    skipKill = ("lockfile.kill is not implemented in the absence of win32api "
     20                "and/or pywintypes.")
     21else:
     22    skipKill = None
     23
     24
    1525class UtilTests(unittest.TestCase):
    1626    """
    1727    Tests for the helper functions used to implement L{FilesystemLock}.
     
    8595        process which exists and signal C{0}.
    8696        """
    8797        lockfile.kill(os.getpid(), 0)
     98    test_kill.skip = skipKill
    8899
    89100
    90101    def test_killESRCH(self):
     
    95106        # Hopefully there is no process with PID 2 ** 31 - 1
    96107        exc = self.assertRaises(OSError, lockfile.kill, 2 ** 31 - 1, 0)
    97108        self.assertEqual(exc.errno, errno.ESRCH)
     109    test_killESRCH.skip = skipKill
    98110
    99111
    100112