Ejemplo n.º 1
0
# -*- coding:utf-8 -*-
"""
@author:oldwai
"""
# email: [email protected]

import read_config
import requests
from log import MyLog as Log

localread_config = read_config.ReadConfig()


class ConfigHttp:
    def __init__(self):
        global host, port, timeout
        host = localread_config.get_http("baseurl")
        port = localread_config.get_http("port")
        timeout = localread_config.get_http("timeout")
        self.log = Log.get_log()
        self.logger = self.log.get_logge()
        self.headers = {}
        self.params = {}
        self.data = {}
        self.url = None
        self.files = {}

    def set_url(self, url):
        self.url = host + url

    def set_headers(self, header):
Ejemplo n.º 2
0
# -*- coding: UTF-8 -*-
#author:zhongqin
import logging
import os
import time

import read_config

cf = read_config.ReadConfig()


class Logging:
    def logger(self, test_case_Id, moudle, test_case_name, result):
        '''日志   将结果写入日志文件'''
        status = ""
        if result:
            status = "PASS"
        else:
            status = "FAIL"

        date = time.strftime('%Y%m%d', time.localtime())  # 获取作为log文件名的日期格式
        dir_path = os.path.join(read_config.abs_path, "results\logfile\\")

        if not os.path.exists(dir_path):
            os.mkdir(dir_path)

        file_path = dir_path + date + ".txt"
        cur_time = time.strftime('%Y-%m-%d %X', time.localtime())
        content = test_case_Id + " , " + moudle + " , " + test_case_name + " , " + str(
            status) + " , " + cur_time + "\n"
        ff = open(file_path, "a+")
Ejemplo n.º 3
0
 def __init__(self, conf_file):
     self.obj_conf = read_config.ReadConfig(conf_file)
     self.conf_dict = self.obj_conf.get_param_in_section('CA')
     self.set_attributs()
     self.set_setup_ca_commnad()
Ejemplo n.º 4
0
import read_config, os, alter_file
config = read_config.ReadConfig().config
print(config['test']['folder1'])
alter_file.alter("file1.txt", "測試", "python")
Ejemplo n.º 5
0
import os, read_config, shutil

def find(target, start):
    for root, dirs, files in os.walk(start):
        for name in files:
            if name.lower().find(target) >= 0:
                return root, name
                # old_path = os.path.join(root, name)
                # print(old_path)
                # new_name = name.replace(target, "Test666")
                # new_path = os.path.join(root, new_name)
                # shutil.copy(old_path, new_path)
        for name in dirs:
            if name.lower().find(target) >= 0:
                return root, name
# return file


if __name__ == "__main__":
    print(find("folder1", read_config.ReadConfig().config["test"]["plateLogic"]))
import os
import sys
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from datetime import datetime
import threading
import zipfile
import glob
import read_config as readconfig
from common.ReportHelper import MyRh

# ======== Reading web_config.ini setting ===========
localReadConfig = readconfig.ReadConfig()


class Email:
    def __init__(self):
        global host, user, password, port, sender, title, content

        host = localReadConfig.get_email("mail_host")
        user = localReadConfig.get_email("mail_user")
        password = localReadConfig.get_email("mail_pass")
        port = localReadConfig.get_email("mail_port")
        sender = localReadConfig.get_email("sender")
        title = localReadConfig.get_email("subject")
        content = localReadConfig.get_email("content")
        host = localReadConfig.get_email("mail_host")
# file 创建数据字典
import os
import pickle
import numpy as np
from create_data_utils import participle_to_label
from create_data_utils import tf_method
import read_config
import json
import time
import random

# 设置读取类型
TRIAN_TYPE = "train"
TEST_TYPE = "test"
# 训练集路径
train_path = read_config.ReadConfig(TRIAN_TYPE).read_file()
test_path = read_config.ReadConfig(TEST_TYPE).read_file()
# 文件存储路径
root = "datasets\\"
# 读取参数
x_train,y_train,x_valid,y_valid = pickle.load(open(train_path,'rb')) 

x_train = []
for data in open(root + "trian.txt"):
    x_train.append(data)
x_valid = []
for data in open(root + "valid.txt"):
    x_valid.append(data)

x_test = ""
y_test = ""
Ejemplo n.º 8
0
import os, read_config, find_target_file, alter_file

old_str = "Test666"
new_str = "Test777"


def change(start):
    # print(old_str, start)
    t = find_target_file.find(old_str, start)
    print(t)
    alter_file.alter(os.path.join(t[0], t[1]), old_str, new_str)
    # return t


if __name__ == "__main__":
    root = read_config.ReadConfig().config["test"]["plateLogic"]
    print(root)
    print(change(root))
    # change("D:/test_data/plateLogic")