def test_leftoverSockets(self):
        """
        Trial reports a L{util.DirtyReactorAggregateError} if a test leaves
        sockets behind.
        """
        suite = self.loader.loadByName(
            "twisted.trial.test.erroneous.SocketOpenTest.test_socketsLeftOpen")
        suite.run(self.result)
        self.assertFalse(self.result.wasSuccessful())
        # socket cleanup happens at end of class's tests.
        # all the tests in the class are successful, even if the suite
        # fails
        self.assertEqual(self.result.successes, 1)
        failure = self.result.errors[0][1]
        self.assertTrue(failure.check(util.DirtyReactorAggregateError))

        Trial reports a L{util.DirtyReactorAggregateError} if a test leaves
        sockets behind.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/test/test_tests.py