MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / test_unbuffered_load_file

Method test_unbuffered_load_file

pymysql/tests/test_load_local.py:47–67  ·  view source on GitHub ↗

Test unbuffered load local infile with a valid file

(self)

Source from the content-addressed store, hash-verified

45 c.execute("DROP TABLE test_load_local")
46
47 def test_unbuffered_load_file(self):
48 """Test unbuffered load local infile with a valid file"""
49 conn = self.connect()
50 c = conn.cursor(cursors.SSCursor)
51 c.execute("CREATE TABLE test_load_local (a INTEGER, b INTEGER)")
52 filename = os.path.join(
53 os.path.dirname(os.path.realpath(__file__)), "data", "load_local_data.txt"
54 )
55 try:
56 c.execute(
57 f"LOAD DATA LOCAL INFILE '{filename}' INTO TABLE test_load_local"
58 + " FIELDS TERMINATED BY ','"
59 )
60 c.execute("SELECT COUNT(*) FROM test_load_local")
61 self.assertEqual(22749, c.fetchone()[0])
62 finally:
63 c.close()
64 conn.close()
65 conn.connect()
66 c = conn.cursor()
67 c.execute("DROP TABLE test_load_local")
68
69 def test_load_warnings(self):
70 """Test load local infile produces the appropriate warnings"""

Callers

nothing calls this directly

Calls 5

cursorMethod · 0.80
executeMethod · 0.80
connectMethod · 0.45
fetchoneMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected