コード例 #1
0
ファイル: R_r_log.py プロジェクト: julystone/keyou
    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
コード例 #2
0
ファイル: R_r_sql.py プロジェクト: julystone/keyou
 def __init__(self, database=None):
     section = 'database'
     host = my_config.get(section, 'host')
     user = my_config.get(section, 'user')
     password = my_config.get(section, 'password')
     database = 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()
コード例 #3
0
ファイル: R_r_re.py プロジェクト: cxh214917/keyou
def my_replace(string, content=None, split='#'):
    while split in string:
        pattern = f"{split}(.+?){split}"
        try:
            arg = re.search(pattern, string).group(1)
            word = my_config.get('account', arg)
        except configparser.NoOptionError:
            word = content if content is not None else getattr(ParmTemp, arg)
        string = re.sub(pattern, word, string, count=1)
    return string
コード例 #4
0
ファイル: case_bidLoan.py プロジェクト: julystone/keyou
import json
import unittest

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

file_name = my_config.get('excel', 'file_name')
file_path = f'{DATA_DIR}{file_name}'
sheet_name = 'bidLoan'
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 BidLoanTestCase(unittest.TestCase):

    def setUp(self) -> None:
コード例 #5
0
import json
import random
import unittest

from suds import client, WebFault

from package_401.common.R_r_config import my_config
from package_401.common.R_r_excel import ReadExcel
from package_401.common.R_r_log import my_log
from package_401.common.R_r_os import DATA_DIR, CONF_DIR
from package_401.common.R_r_re import myRex, ParmTemp
from package_401.common.R_r_sql import Mysql
from package_401.library.ddt import ddt, data

api = my_config.get('env', 'api')

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


def one_number(number):
    head = '139'
    for _ in range(number - len(head)):
        head += str(random.randint(0, 9))
    return head


def do_assert(actual, expect, cls, case):
    try:
        cls.assertEqual((expect["retCode"], expect['retInfo']),