'Test load local infile with a valid file'

def test_load_file(self):

    conn = self.connections[0]
    c = conn.cursor()
    c.execute('CREATE    TABLE    test_load_local    (a    INTEGER,    b    INTEGER)')
    filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data', 'load_local_data.txt')
    try:
        c.execute(("LOAD    DATA    LOCAL    INFILE    '{0}'    INTO    TABLE    " + "test_load_local    FIELDS    TERMINATED    BY    ','").format(filename))
        c.execute('SELECT    COUNT(*)    FROM    test_load_local')
        self.assertEqual(22749, c.fetchone()[0])
    finally:
        c.execute('DROP    TABLE    test_load_local')
