Adding upstream version 1.29.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
5bd6a68e8c
commit
f9065f1bef
68 changed files with 3723 additions and 3336 deletions
|
@ -9,20 +9,18 @@ import pytest
|
|||
|
||||
from mycli.main import special
|
||||
|
||||
PASSWORD = os.getenv('PYTEST_PASSWORD')
|
||||
USER = os.getenv('PYTEST_USER', 'root')
|
||||
HOST = os.getenv('PYTEST_HOST', 'localhost')
|
||||
PORT = int(os.getenv('PYTEST_PORT', 3306))
|
||||
CHARSET = os.getenv('PYTEST_CHARSET', 'utf8')
|
||||
SSH_USER = os.getenv('PYTEST_SSH_USER', None)
|
||||
SSH_HOST = os.getenv('PYTEST_SSH_HOST', None)
|
||||
SSH_PORT = os.getenv('PYTEST_SSH_PORT', 22)
|
||||
PASSWORD = os.getenv("PYTEST_PASSWORD")
|
||||
USER = os.getenv("PYTEST_USER", "root")
|
||||
HOST = os.getenv("PYTEST_HOST", "localhost")
|
||||
PORT = int(os.getenv("PYTEST_PORT", 3306))
|
||||
CHARSET = os.getenv("PYTEST_CHARSET", "utf8")
|
||||
SSH_USER = os.getenv("PYTEST_SSH_USER", None)
|
||||
SSH_HOST = os.getenv("PYTEST_SSH_HOST", None)
|
||||
SSH_PORT = os.getenv("PYTEST_SSH_PORT", 22)
|
||||
|
||||
|
||||
def db_connection(dbname=None):
|
||||
conn = pymysql.connect(user=USER, host=HOST, port=PORT, database=dbname,
|
||||
password=PASSWORD, charset=CHARSET,
|
||||
local_infile=False)
|
||||
conn = pymysql.connect(user=USER, host=HOST, port=PORT, database=dbname, password=PASSWORD, charset=CHARSET, local_infile=False)
|
||||
conn.autocommit = True
|
||||
return conn
|
||||
|
||||
|
@ -30,20 +28,18 @@ def db_connection(dbname=None):
|
|||
try:
|
||||
db_connection()
|
||||
CAN_CONNECT_TO_DB = True
|
||||
except:
|
||||
except Exception:
|
||||
CAN_CONNECT_TO_DB = False
|
||||
|
||||
dbtest = pytest.mark.skipif(
|
||||
not CAN_CONNECT_TO_DB,
|
||||
reason="Need a mysql instance at localhost accessible by user 'root'")
|
||||
dbtest = pytest.mark.skipif(not CAN_CONNECT_TO_DB, reason="Need a mysql instance at localhost accessible by user 'root'")
|
||||
|
||||
|
||||
def create_db(dbname):
|
||||
with db_connection().cursor() as cur:
|
||||
try:
|
||||
cur.execute('''DROP DATABASE IF EXISTS mycli_test_db''')
|
||||
cur.execute('''CREATE DATABASE mycli_test_db''')
|
||||
except:
|
||||
cur.execute("""DROP DATABASE IF EXISTS mycli_test_db""")
|
||||
cur.execute("""CREATE DATABASE mycli_test_db""")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
|
@ -53,8 +49,7 @@ def run(executor, sql, rows_as_list=True):
|
|||
|
||||
for title, rows, headers, status in executor.run(sql):
|
||||
rows = list(rows) if (rows_as_list and rows) else rows
|
||||
result.append({'title': title, 'rows': rows, 'headers': headers,
|
||||
'status': status})
|
||||
result.append({"title": title, "rows": rows, "headers": headers, "status": status})
|
||||
|
||||
return result
|
||||
|
||||
|
@ -87,8 +82,6 @@ def send_ctrl_c(wait_seconds):
|
|||
Returns the `multiprocessing.Process` created.
|
||||
|
||||
"""
|
||||
ctrl_c_process = multiprocessing.Process(
|
||||
target=send_ctrl_c_to_pid, args=(os.getpid(), wait_seconds)
|
||||
)
|
||||
ctrl_c_process = multiprocessing.Process(target=send_ctrl_c_to_pid, args=(os.getpid(), wait_seconds))
|
||||
ctrl_c_process.start()
|
||||
return ctrl_c_process
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue