'When cancelling a L{defer.Deferred} returned by
L{defer.DeferredFilesystemLock.deferUntilLocked}, the
L{defer.DeferredFilesystemLock._tryLockCall} is cancelled.'

def test_cancelDeferUntilLocked(self):

    self.lock.lock()
    deferred = self.lock.deferUntilLocked()
    tryLockCall = self.lock._tryLockCall
    deferred.cancel()
    self.assertFalse(tryLockCall.active())
    self.assertIsNone(self.lock._tryLockCall)
    self.failureResultOf(deferred, defer.CancelledError)
