def test_get_host_info(self):
        config = self.connect_kwargs.copy()
        cmy = MySQL(buffered=True)
        self.assertRaises(MySQLInterfaceError, cmy.get_host_info)

        cmy.connect(**config)

        if os.name == 'posix':
            # On POSIX systems we would be connected by UNIX socket
            self.assertTrue('via UNIX socket' in cmy.get_host_info())

        # Connect using TCP/IP
        config['unix_socket'] = None
        cmy.connect(**config)
        self.assertTrue('via TCP/IP' in cmy.get_host_info())
Esempio n. 2
0
    def test_get_host_info(self):
        config = self.connect_kwargs.copy()
        cmy = MySQL(buffered=True)
        self.assertRaises(MySQLInterfaceError, cmy.get_host_info)

        cmy.connect(**config)

        if os.name == 'posix':
            # On POSIX systems we would be connected by UNIX socket
            self.assertTrue('via UNIX socket' in cmy.get_host_info())

        # Connect using TCP/IP
        config['unix_socket'] = None
        cmy.connect(**config)
        self.assertTrue('via TCP/IP' in cmy.get_host_info())