Esempio n. 1
0
 def write_result(self, row, actual, result):
     wb, ws = self.load_excel()
     if isinstance(row, int) and (2 <= row <= ws.max_row):
         ws.cell(row=row, column=do_config.get_int('excel', 'actual_col'), value=actual)
         ws.cell(row=row, column=do_config.get_int('excel', 'result_col'), value=result)
         wb.save(self.filename)
         wb.close()
Esempio n. 2
0
 def __init__(self):
     self.conn = pymysql.connect(
         host=do_config.get_value('mysql', 'host'),
         user=do_config.get_value('mysql', 'user'),
         password=do_config.get_value('mysql', 'password'),
         db=do_config.get_value('mysql', 'db'),
         port=do_config.get_int('mysql', 'port'),
         charset=do_config.get_value('mysql', 'charset'),
         cursorclass=pymysql.cursors.DictCursor)
     self.cursor = self.conn.cursor()
def excel_suite1():
    not_existed_tel = do_mysql.not_existed_tel(
        do_config.get_value('mysql', 'not_existed_tel'))
    register_excel = HandleExcel(do_config.get_value('file path', 'case_path'),
                                 'login')
    register_excel_cases = register_excel.get_case()
    register_excel_re = re.sub(r'\${not_existed_tel}', not_existed_tel,
                               str(register_excel_cases))
    existed_tel = do_mysql.existed_tel(
        do_config.get_value('mysql', 'existed_tel'),
        do_config.get_int('mysql', 'existed_tel_type'))
    register_cases = re.sub(r'\${existed_tel}', existed_tel,
                            str(register_excel_re))
    register_cases = eval(register_cases)
    wb, ws = register_excel.load_excel()
    wb.close()
    return register_cases
Esempio n. 4
0
@Contact: [email protected]
@Project: Jomer
@File: cw_0709_mysql.py
@Time: 2019-07-11 00:26
@Desc: Jungle old monster
"""

import pymysql

from interface_automation.class_0709_mysql.cw_0709_config import do_config

host = do_config.get_value('mysql', 'host')
user = do_config.get_value('mysql', 'user')
password = do_config.get_value('mysql', 'password')
db = do_config.get_value('mysql', 'db')
port = do_config.get_int('mysql', 'port')
charset = do_config.get_value('mysql', 'charset')

# 链接数据库
conn = pymysql.connect(
    host=host,
    user=user,
    password=password,
    db=db,
    port=port,
    charset=charset,  # 编码只能写utf8
    cursorclass=pymysql.cursors.DictCursor  # 执行SQL的结果为字典类型
)
# 创建游标
cursor = conn.cursor()