Ejemplo n.º 1
0
    def __new__(cls):
        log_path = LOG_DIR

        name = my_config.get('log', 'name')
        all_level = my_config.get('log', 'all_level')
        ls_level = my_config.get('log', 'ls_level')
        fs_level = my_config.get('log', 'fs_level')
        # log_path = my_config.get('log', 'log_path')

        my_log = logging.getLogger(name)
        my_log.setLevel(all_level)

        my_ls = logging.StreamHandler()
        my_ls.setLevel(ls_level)
        my_lf = logging.FileHandler(f"{log_path}{time.strftime('log_%Y_%m_%d_%H', time.localtime())}.log",
                                    encoding='utf8')
        my_lf.setLevel(fs_level)

        format = '%(asctime)s | %(process)s | [%(filename)s-->line:%(lineno)d] | %(levelname)-5s: %(message)s'
        my_format = logging.Formatter(format)

        my_ls.setFormatter(my_format)
        my_lf.setFormatter(my_format)

        my_log.addHandler(my_ls)
        my_log.addHandler(my_lf)

        return my_log
Ejemplo n.º 2
0
 def __init__(self):
     section = 'database'
     host = my_config.get(section, 'host')
     user = my_config.get(section, 'user')
     password = my_config.get(section, 'password')
     database = my_config.get(section, 'database')
     port = my_config.get(section, 'port')
     charset = my_config.get(section, 'charset')
     self.con = pymysql.connect(host=host,
                                user=user,
                                password=password,
                                database=database,
                                port=eval(port),
                                charset=charset)
     self.cur = self.con.cursor()
Ejemplo n.º 3
0
import json
import unittest

from package_201.common.R_r_config import my_config
from package_201.common.R_r_excel import ReadExcel
from package_201.common.R_r_log import my_log
from package_201.common.R_r_os import DATA_DIR, CONF_DIR
from package_201.common.R_request import HttpRequestNoCookie, HttpRequest
from package_201.common.generate import Generate
from package_201.library.ddt import ddt, data

file_name = my_config.get('excel', 'file_name')
file_path = f'{DATA_DIR}{file_name}'
sheet_name = 'withdraw'
columns_read = my_config.get('excel', 'columns_read')

testRequestNoCookie = HttpRequestNoCookie()
testRequest = HttpRequest()

my_generate = Generate(file_path, sheet_name, yaml_file=f'{CONF_DIR}parms.yaml')
my_generate.generate()

wb = ReadExcel(file_path, sheet_name)
# cases = wb.r_data_obj_from_column(eval(columns_read))
cases = wb.read_data_obj()


@ddt
class WithdrawTestCase(unittest.TestCase):

    def setUp(self) -> None:
Ejemplo n.º 4
0
import json
import unittest

from package_201.common.R_r_config import my_config
from package_201.common.R_r_excel import ReadExcel
from package_201.common.R_r_log import my_log
from package_201.common.R_r_os import DATA_DIR, CONF_DIR
from package_201.common.R_r_sql import Mysql
from package_201.common.R_request import HttpRequestNoCookie, HttpRequest
from package_201.common.generate import my_generate
from package_201.library.ddt import ddt, data

file_name = my_config.get('excel', 'file_name')
file_path = f'{DATA_DIR}{file_name}'
yaml_file = f'{CONF_DIR}parms.yaml'
# sheet_name = 'login'

testRequestNoCookie = HttpRequestNoCookie()
testRequest = HttpRequest()


@ddt
class LoginTestCase(unittest.TestCase):
    sheet_name = 'login'
    my_generate.generate(sheet_name, file_path, yaml_file)
    wb = ReadExcel(file_path, sheet_name)
    cases = wb.read_data_obj()

    @classmethod
    def tearDownClass(cls):
        # login