'http://dev.mysql.com/doc/refman/5.0/en/gone-away.html
http://dev.mysql.com/doc/refman/5.0/en/error-messages-client.html#error_cr_server_gone_error'

def test_connection_gone_away(self):

    con = self.connections[0]
    cur = con.cursor()
    cur.execute('SET    wait_timeout=1')
    time.sleep(2)
    with self.assertRaises(pymysql.OperationalError) as cm:
        cur.execute('SELECT    1+1')
    self.assertIn(cm.exception.args[0], (2006, 2013))
