def test_tearDownRunsOnTestFailure(self):
        """
        L{SynchronousTestCase.tearDown} runs when a test method fails.
        """
        suite = self.loader.loadTestsFromTestCase(
            self.TestFailureButTearDownRuns)

        case = list(suite)[0]
        self.assertFalse(case.tornDown)

        suite.run(self.reporter)
        errors = self.reporter.errors
        self.assertTrue(len(errors) > 0)
        self.assertIsInstance(errors[0][1].value, erroneous.FoolishError)
        self.assertEqual(0, self.reporter.successes)

        self.assertTrue(case.tornDown)

        L{SynchronousTestCase.tearDown} runs when a test method fails.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/test/test_tests.py