def setUp(self): """ :return: """ self.log = Log.get_log() self.logger = self.log.get_logger() # login self.login_token
def run(): logger = get_log() logger.info('=' * 20 + 'Run test start!' + '=' * 20) now = time.strftime('%Y_%m_%d_%H_%M_%S') report_name = './report/report_' + now + '.html' with open(report_name, 'wb') as f: runner = HTMLTestRunner(f, title='测试报告', tester='') runner.run(discover) logger.info('=' * 20 + 'Run test end!' + '=' * 20) mail('TestResult')
import pymysql import pandas as pd from common.readConfig import ReadConfig from common.baseClass import Structure from common.log import get_log pymysql.install_as_MySQLdb() logger = get_log() class Db(Structure): _fields = ['host', 'port', 'user', 'password', 'db'] # def __init__(self, host, port, user, password, db): # self.host = host # self.port = port # self.user = user # self.password = password # self.db=db @classmethod def read_config(cls, section, path=None): instance = cls.__new__(cls) parser = ReadConfig(path) parser.update_attr(instance, section) return instance def connect(self): try: con = pymysql.connect(host=self.host,