def test_resolveNameFailure(self):
        """
        A resolution failure is logged with the name that failed to
        resolve and the callable that tried to resolve it.  The
        resolution receiver begins, receives no addresses, and
        completes.
        """
        logs = []

        @provider(ILogObserver)
        def captureLogs(event):
            logs.append(event)

        globalLogPublisher.addObserver(captureLogs)
        self.addCleanup(lambda: globalLogPublisher.removeObserver(captureLogs))

        receiver = self.resolver.resolveHostName(self.receiver, "example.com")

        self.assertIs(receiver, self.receiver)

        self.fakeResolverReturns.errback(Exception())

        self.assertEqual(1, len(logs))
        self.assertEqual(1, len(self.flushLoggedErrors(Exception)))

        [event] = logs
        self.assertTrue(event.get("isError"))
        self.assertTrue(event.get("name", "example.com"))
        self.assertTrue(event.get("callable", repr(self.fakeResolver)))

        self.assertEqual(1, len(self.resolutionBeganCalls))
        self.assertEqual(self.resolutionBeganCalls[0].name, "example.com")
        self.assertFalse(self.addressResolvedCalls)
        self.assertEqual(1, self.resolutionCompleteCallCount)

        A resolution failure is logged with the name that failed to
        resolve and the callable that tried to resolve it.  The
        resolution receiver begins, receives no addresses, and
        completes.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_endpoints.py