'Test the C{shouldStop} management: raising a C{KeyboardInterrupt} must
interrupt the suite.'

def test_shouldStop(self):

    called = []
    class MockTest(unittest.TestCase, ):
        def test_foo1(test):
            called.append(1)
        def test_foo2(test):
            raise KeyboardInterrupt()
        def test_foo3(test):
            called.append(2)
    result = reporter.TestResult()
    loader = runner.TestLoader()
    loader.suiteFactory = runner.DestructiveTestSuite
    suite = loader.loadClass(MockTest)
    self.assertEqual(called, [])
    suite.run(result)
    self.assertEqual(called, [1])
    self.assertEqual(suite.countTestCases(), 1)
