-1

travis-ci.org でテストを行います。

テストコードは

import MySQLdb

create_tbl_SQL = open("tables.sql").read()

conn = MySQLdb.connect(db = "test_travis", user = "root", passwd = "", charset =     "utf8", host = "localhost", port = 3306)

def create_tables():
    conn.cursor().execute(create_tbl_SQL)

def drop_tables():
    conn.cursor().execute("drop table user, post;")

create_tables()

conn1 = MySQLdb.connect(db = "test_travis", user = "root", passwd = "", charset =    "utf8", host = "localhost", port = 3306)

c = conn1.cursor()

c.execute("insert into user set user.name = '111'")

c.execute("select * from user; ")

drop_tables()

ただし、travis-ci.org のテストでは、これを実行するのに 3 分かかります。

このコードは github にあります: https://github.com/hit9/test_mysql_on_travis/

travis-ci.org でのこのテスト:https://travis-ci.org/hit9/test_mysql_on_travis

「テーブルのドロップ」アクションにより、このスクリプトの実行が遅くなると思います。

しかし、どうすればこれを解決できますか?

4

1 に答える 1

1

私が試してみました

mysql -e "set autocommit=1"

私の.travis.ymlでは、しかしそれは機能していませんでした

したがって、ドロップステートメントの前にこの行を挿入する必要があります

c.execute("commit ")
于 2013-01-06T09:47:57.583 に答える