Пример #1
0
    def __init__(self, file_path=None):
        if file_path == None:
            self.file_path = FileConfig().get_path(type="element")
        else:
            self.file_path = file_path

        self.data = self.read_ini()
 def read_data(self):
     """
     获取数据
     :return:
     """
     with open(FileConfig().get_path(), 'r') as fr:
         data = yaml.safe_load(fr)
     return data
 def clear_data(self):
     """
     清楚数据
     :return:
     """
     with open(FileConfig().get_path(), 'w') as fr:
         fr.truncate()
     fr.close()
Пример #4
0
 def save_screenshots(self, img_doc):
     file_name = FileConfig().get_path(type="pics") + "{}_{}.png".format(
         datetime.datetime.now().strftime("%Y-%m-%d %H%M%S"), img_doc)
     self.driver.save_screenshot(file_name)
     with open(file_name, mode='rb') as f:
         file = f.read()
     # return file_name
     allure.attach(file, img_doc, allure.attachment_type.PNG)
 def setup_class(cls):
     print("开始执行初次安装")
     cls.filepath = FileConfig().get_path(type="apk")
     cls.logInfo = LogInfo()
     # cls.path = ("../com.xiaomi.hm.health.apk")
     cls.check_command = "adb shell pm path com.xiaomi.hm.health"
     cls.install_command = "adb install " + cls.filepath
     cls.uninstall_command = "adb uninstall com.xiaomi.hm.health"
 def write_data(self,  i, deviceName, bp, port):
     """
     写入数据
     :param data:
     :return:
     """
     data = self.join_data( i, deviceName, bp, port)
     with open(FileConfig().get_path(), 'a') as fr:
         yaml.dump(data, fr)
Пример #7
0
 def __init__(self):
     self.dos_cmd = DosCmd()
     self.deviceName = os.environ["deviceName"]
     self.deviceBrandName = os.environ["deviceBrandName"]
     self.now = time.strftime("%Y-%m-%d-%H-%M-%S",
                              time.localtime(time.time()))
     # self.filename = FileConfig().get_path(type="log") + self.now + r".txt"
     self.filename = self.now + r".txt"
     self.file_path = FileConfig().get_path(type="logs") + self.filename
     self.logcat_file = open(self.file_path, 'w')
     # logcmd = "adb logcat -v time"
     logcmd = "sudo docker exec - i $" + self.deviceBrandName + " adb logcat -v time"
     # logcmd = "adb logcat -v time"
     self.Poplog = subprocess.Popen(logcmd,
                                    shell=True,
                                    stdout=self.logcat_file,
                                    stderr=subprocess.PIPE)
 def setup_class(cls):
     print("开始执行覆盖安装")
     cls.filepath = FileConfig().get_path(type="apk")
     cls.logInfo = LogInfo()
     cls.command = "adb install -r " + cls.filepath