def test_getPasswordConchError(self):
        """
        Get the password using
        L{twisted.conch.client.default.SSHUserAuthClient.getPassword}
        and trigger a {twisted.conch.error import ConchError}.
        """
        options = ConchOptions()
        client = SSHUserAuthClient(b"user",  options, None)

        def getpass(prompt):
            raise KeyboardInterrupt("User pressed CTRL-C")

        self.patch(default.getpass, 'getpass', getpass)
        stdout, stdin = sys.stdout, sys.stdin
        d = client.getPassword(b'?')
        @d.addErrback
        def check_sys(fail):
            self.assertEqual(
                [stdout, stdin], [sys.stdout, sys.stdin])
            return fail
        self.assertFailure(d, ConchError)

        Get the password using
        L{twisted.conch.client.default.SSHUserAuthClient.getPassword}
        and trigger a {twisted.conch.error import ConchError}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_default.py