Example #1
0
    def __init__(self, sec_name):
        r = ReadConfig()
        self.conf = r.getValue(sec_name)

        self.connect = pymysql.Connect(host=self.conf['url'],
                                       port=self.conf['port'],
                                       user=str(self.conf['username']),
                                       passwd=str(self.conf['password']),
                                       db=self.conf['db'],
                                       charset='utf8')

        self.cursor = self.connect.cursor()
        logs.info('成功连接数据库')
# coding=utf-8

import os
from common.read_config import ReadConfig

# 读取配置文件
config_file_path = os.path.split(os.path.realpath(__file__))[0]
read_config = ReadConfig(os.path.join(config_file_path, 'config.ini'))
# 项目参数设置
prj_path = read_config.getValue('projectConfig', 'project_path')
# 日志路径
log_path = os.path.join(prj_path, 'report', 'log')
# 截图文件路径
img_path = os.path.join(prj_path, 'report', 'image')
# 测试报告路径
report_path = os.path.join(prj_path, 'report', 'testreport')

# 测试数据路径
data_path = os.path.join(prj_path, 'data', 'testdata')