提交 7b4de874 authored 作者: 陈泽健's avatar 陈泽健

refactor(预定系统): 重构测试用例的路径设置和模块导入

- 新增兼容 PyInstaller 打包后的路径设置
- 优化 sys.path 的设置,确保 Base 目录始终在最前
- 更新模块导入方式,使用相对路径导入 base 模块- 删除重复的代码块和不必要的注释
上级 6f3c707e
...@@ -186,8 +186,8 @@ def get_login_url_from_config(login_type): ...@@ -186,8 +186,8 @@ def get_login_url_from_config(login_type):
# 获取当前脚本的绝对路径 # 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建配置文件的绝对路径,指向 ubains-module-test 目录下的 config.json # 构建配置文件的绝对路径,指向与 Base 同级的 config.json
config_path = os.path.abspath(os.path.join(current_dir, '..', '..', 'config.json')) config_path = os.path.join(os.path.dirname(current_dir), 'config.json')
# 规范化路径,防止路径遍历攻击 # 规范化路径,防止路径遍历攻击
config_path = os.path.normpath(config_path) config_path = os.path.normpath(config_path)
...@@ -220,6 +220,8 @@ def get_login_url_from_config(login_type): ...@@ -220,6 +220,8 @@ def get_login_url_from_config(login_type):
# 如果未找到对应的 URL,则抛出异常 # 如果未找到对应的 URL,则抛出异常
raise ValueError(f"未找到对应的 URL 配置项: {login_type}") raise ValueError(f"未找到对应的 URL 配置项: {login_type}")
print("正在打开登录页面:" + login_url)
# 返回登录 URL # 返回登录 URL
return login_url return login_url
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径
# 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 sys.path.insert(0, base_dir)
sys.path.append(预定系统_path)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * def suite_teardown():
browser_quit()
# def suite_setup(): # def suite_setup():
# STEP(1, "初始化浏览器") # STEP(1, "初始化浏览器")
# browser_init() # browser_init()
# # STEP(2, "处理SSL认证") # # STEP(2, "处理SSL认证")
# # handle_ssl_warning() # # handle_ssl_warning()
\ No newline at end of file
def suite_teardown():
browser_quit()
\ No newline at end of file
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from datetime import datetime, timedelta
from time import sleep
import sys import sys
import os import os
# 获取当前脚本的绝对路径 from hytest import *
# 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys
import os
import openpyxl
import json
from 预定系统.Base.base import INFO
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..', '..'))
# 添加路径
sys.path.append(预定系统_path)
# 导入模块
from 预定系统.Base.base import *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建CSV文件的绝对路径
csv_file_path = os.path.join(current_dir, '../../../测试数据/登录模块/新账号密码登录.xlsx')
def read_xlsx_data(xlsx_file_path):
"""
读取XLSX文件中的数据,并将其转换为一个包含字典的列表,每个字典代表一行测试用例数据。
参数:
xlsx_file_path (str): XLSX文件的路径。
返回:
list: 包含字典的列表,每个字典包含测试用例的名称和参数。
"""
# 打开XLSX文件
workbook = openpyxl.load_workbook(xlsx_file_path)
# 假设数据在第一个工作表中
sheet = workbook.active
# 读取表头,从第三行开始
headers = [cell.value for cell in sheet[3]]
# 打印表头列名
# print(f"表头列名: {headers}")
# 找到表头中名为 'JSON' 的列索引
try:
json_index = headers.index('JSON')
except ValueError as e:
raise ValueError(f"表头中没有找到所需的列: {e}")
ddt_cases = []
# 遍历XLSX文件中的每一行数据,从第四行开始
for row in sheet.iter_rows(min_row=4, values_only=True):
# 获取 JSON 列的数据
json_data = row[json_index]
# 打印 JSON 数据以进行调试
# print(f"JSON 数据: {json_data}")
# 解析 JSON 字符串
try:
if json_data:
parsed_json = json.loads(json_data)
else:
raise ValueError("JSON 数据为空")
except json.JSONDecodeError:
raise ValueError(f"无法解析 JSON 数据: {json_data}")
# 将解析后的 JSON 数据添加到列表中
ddt_cases.append(parsed_json)
# 日志记录:XLSX文件已读取
INFO("XLSX文件已读取")
# 返回包含所有测试用例数据的列表
return ddt_cases
if __name__ == '__main__':
ddt_cases = read_xlsx_data(csv_file_path)
# print(ddt_cases)
browser_init("标准版预定系统")
wd = GSTORE['wd']
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
for step in case:
print(f"当前步骤: {step}")
# 你可以在这里对 step 进行进一步处理
# 例如:访问特定字段
# page = step.get('page')
# 调用get_by_enum将定位类型转为枚举
locator_type = get_by_enum(step.get('locator_type'))
locator_value = step.get('locator_value')
element_type = step.get('element_type')
element_value = step.get('element_value')
#
# print(f"页面: {page}")
# print(f"元素定位类型: {locator_type}")
# print(f"元素定位值: {locator_value}")
# print(f"元素类型: {element_type}")
# print(f"输入值: {element_value}")
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(5)
\ No newline at end of file
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径
# 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
from datetime import timedelta
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径
# 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
from datetime import timedelta
import sys import sys
import os import os
from hytest import *
from pkg_resources import safe_listdir # 获取 Base 目录的绝对路径,并加入 sys.path
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径
# 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from time import sleep from hytest import *
from datetime import timedelta
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径
# 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from datetime import datetime, timedelta import sys
from time import sleep
import sys import sys
import os import os
from selenium.webdriver.support.expected_conditions import element_to_be_clickable # 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
# 获取当前脚本的绝对路径 base_path = os.path.abspath(base_path)
current_dir = os.path.dirname(os.path.abspath(__file__)) base_base_path = os.path.join(base_path, 'Base')
# 构建预定系统的绝对路径 if base_base_path not in sys.path:
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) sys.path.insert(0, base_base_path)
# 添加路径
sys.path.append(预定系统_path) from base import *
# 导入模块
from 预定系统.Base.base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from datetime import datetime, timedelta import sys
from time import sleep
import sys import sys
import os import os
from selenium.webdriver.support.expected_conditions import element_to_be_clickable # 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
# 获取当前脚本的绝对路径 base_path = os.path.abspath(base_path)
current_dir = os.path.dirname(os.path.abspath(__file__)) base_base_path = os.path.join(base_path, 'Base')
# 构建预定系统的绝对路径 if base_base_path not in sys.path:
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) sys.path.insert(0, base_base_path)
# 添加路径
sys.path.append(预定系统_path) from base import *
# 导入模块
from 预定系统.Base.base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径
# 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from datetime import datetime, timedelta
from time import sleep
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import logging
from datetime import datetime, timedelta
from time import sleep
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径
# 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径
# 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from time import sleep import sys
from hytest import * import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) # 兼容 PyInstaller 打包后的路径
# 构建预定系统的绝对路径 if hasattr(sys, '_MEIPASS'):
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = sys._MEIPASS
# 添加路径 else:
sys.path.append(预定系统_path) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 导入模块
try: base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
except ModuleNotFoundError as e: if base_base_path not in sys.path:
print(f"ModuleNotFoundError: {e}") sys.path.insert(0, base_base_path)
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from time import sleep import sys
from hytest import * import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) # 兼容 PyInstaller 打包后的路径
# 构建预定系统的绝对路径 if hasattr(sys, '_MEIPASS'):
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = sys._MEIPASS
# 添加路径 else:
sys.path.append(预定系统_path) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 导入模块
try: base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
except ModuleNotFoundError as e: if base_base_path not in sys.path:
print(f"ModuleNotFoundError: {e}") sys.path.insert(0, base_base_path)
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from time import sleep import sys
from hytest import * import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) # 兼容 PyInstaller 打包后的路径
# 构建预定系统的绝对路径 if hasattr(sys, '_MEIPASS'):
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = sys._MEIPASS
# 添加路径 else:
sys.path.append(预定系统_path) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 导入模块
try: base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
except ModuleNotFoundError as e: if base_base_path not in sys.path:
print(f"ModuleNotFoundError: {e}") sys.path.insert(0, base_base_path)
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from time import sleep import sys
from hytest import * import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) # 兼容 PyInstaller 打包后的路径
# 构建预定系统的绝对路径 if hasattr(sys, '_MEIPASS'):
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = sys._MEIPASS
# 添加路径 else:
sys.path.append(预定系统_path) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 导入模块
try: base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
except ModuleNotFoundError as e: if base_base_path not in sys.path:
print(f"ModuleNotFoundError: {e}") sys.path.insert(0, base_base_path)
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
from time import sleep import sys
from hytest import * import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) # 兼容 PyInstaller 打包后的路径
# 构建预定系统的绝对路径 if hasattr(sys, '_MEIPASS'):
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = sys._MEIPASS
# 添加路径 else:
sys.path.append(预定系统_path) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 导入模块
try: base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
except ModuleNotFoundError as e: if base_base_path not in sys.path:
print(f"ModuleNotFoundError: {e}") sys.path.insert(0, base_base_path)
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from time import sleep import sys
from hytest import * import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) # 兼容 PyInstaller 打包后的路径
# 构建预定系统的绝对路径 if hasattr(sys, '_MEIPASS'):
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = sys._MEIPASS
# 添加路径 else:
sys.path.append(预定系统_path) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 导入模块
try: base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
except ModuleNotFoundError as e: if base_base_path not in sys.path:
print(f"ModuleNotFoundError: {e}") sys.path.insert(0, base_base_path)
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from time import sleep import sys
from hytest import * import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) # 兼容 PyInstaller 打包后的路径
# 构建预定系统的绝对路径 if hasattr(sys, '_MEIPASS'):
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = sys._MEIPASS
# 添加路径 else:
sys.path.append(预定系统_path) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 导入模块
try: base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
except ModuleNotFoundError as e: if base_base_path not in sys.path:
print(f"ModuleNotFoundError: {e}") sys.path.insert(0, base_base_path)
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from time import sleep import sys
from hytest import * import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) # 兼容 PyInstaller 打包后的路径
# 构建预定系统的绝对路径 if hasattr(sys, '_MEIPASS'):
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = sys._MEIPASS
# 添加路径 else:
sys.path.append(预定系统_path) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 导入模块
try: base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
except ModuleNotFoundError as e: if base_base_path not in sys.path:
print(f"ModuleNotFoundError: {e}") sys.path.insert(0, base_base_path)
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
from time import sleep import sys
from hytest import * import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) # 兼容 PyInstaller 打包后的路径
# 构建预定系统的绝对路径 if hasattr(sys, '_MEIPASS'):
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = sys._MEIPASS
# 添加路径 else:
sys.path.append(预定系统_path) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 导入模块
try: base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
except ModuleNotFoundError as e: if base_base_path not in sys.path:
print(f"ModuleNotFoundError: {e}") sys.path.insert(0, base_base_path)
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from time import sleep import sys
from hytest import * import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) # 兼容 PyInstaller 打包后的路径
# 构建预定系统的绝对路径 if hasattr(sys, '_MEIPASS'):
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = sys._MEIPASS
# 添加路径 else:
sys.path.append(预定系统_path) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 导入模块
try: base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
except ModuleNotFoundError as e: if base_base_path not in sys.path:
print(f"ModuleNotFoundError: {e}") sys.path.insert(0, base_base_path)
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from time import sleep import sys
from hytest import * import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) # 兼容 PyInstaller 打包后的路径
# 构建预定系统的绝对路径 if hasattr(sys, '_MEIPASS'):
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = sys._MEIPASS
# 添加路径 else:
sys.path.append(预定系统_path) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 导入模块
try: base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
except ModuleNotFoundError as e: if base_base_path not in sys.path:
print(f"ModuleNotFoundError: {e}") sys.path.insert(0, base_base_path)
print("尝试使用绝对路径导入")
from 预定系统.Base.base import * from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from selenium.webdriver.support.expected_conditions import element_to_be_clickable # 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
# 获取当前脚本的绝对路径 base_path = os.path.abspath(base_path)
current_dir = os.path.dirname(os.path.abspath(__file__)) base_base_path = os.path.join(base_path, 'Base')
# 构建预定系统的绝对路径 if base_base_path not in sys.path:
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) sys.path.insert(0, base_base_path)
# 添加路径
sys.path.append(预定系统_path) from base import *
# 导入模块
from 预定系统.Base.base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from datetime import datetime, timedelta
from time import sleep
import sys import sys
import os import os
from selenium.webdriver.support.expected_conditions import element_to_be_clickable # 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
# 获取当前脚本的绝对路径 base_path = os.path.abspath(base_path)
current_dir = os.path.dirname(os.path.abspath(__file__)) base_base_path = os.path.join(base_path, 'Base')
# 构建预定系统的绝对路径 if base_base_path not in sys.path:
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) sys.path.insert(0, base_base_path)
# 添加路径
sys.path.append(预定系统_path) from base import *
# 导入模块
from 预定系统.Base.base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径
# 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
class Server_monitoring_0001: class Server_monitoring_0001:
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from venv import logger from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
from 预定系统.Base.app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化设备adb连接") STEP(1, "初始化设备adb连接")
......
from 预定系统.Base.app_base import *
import logging import logging
from time import sleep from time import sleep
from hytest import * from hytest import *
import sys
import os
# 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
base_path = os.path.abspath(base_path)
base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from app_base import *
# 配置日志记录 # 配置日志记录
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
from app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
from datetime import timedelta
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
try: base_base_path = os.path.join(base_path, 'Base')
from 预定系统.Base.base import * if base_base_path not in sys.path:
except ModuleNotFoundError as e: sys.path.insert(0, base_base_path)
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入") from base import *
from 预定系统.Base.base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from datetime import timedelta
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
try: base_base_path = os.path.join(base_path, 'Base')
from 预定系统.Base.base import * if base_base_path not in sys.path:
except ModuleNotFoundError as e: sys.path.insert(0, base_base_path)
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入") from base import *
from 预定系统.Base.base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from 预定系统.Base.app_base import * import sys
import logging import os
import time
# 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
base_path = os.path.abspath(base_path)
base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from app_base import *
class same_screen_share_000x: class same_screen_share_000x:
""" """
......
from 预定系统.Base.app_base import * import sys
import logging import os
import time
# 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
base_path = os.path.abspath(base_path)
base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from app_base import *
class SameScreenShare: class SameScreenShare:
""" """
......
from appium.webdriver.common.appiumby import AppiumBy from appium.webdriver.common.appiumby import AppiumBy
from 预定系统.Base.app_base import *
import logging import logging
from time import sleep from time import sleep
from hytest import * from hytest import *
import sys
import os
# 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
base_path = os.path.abspath(base_path)
base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from app_base import *
# 配置日志记录 # 配置日志记录
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
......
from appium.webdriver.common.appiumby import AppiumBy from appium.webdriver.common.appiumby import AppiumBy
from 预定系统.Base.app_base import *
import logging import logging
from time import sleep from time import sleep
from hytest import * from hytest import *
import sys
import os
# 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
base_path = os.path.abspath(base_path)
base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from app_base import *
# 配置日志记录 # 配置日志记录
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
from 预定系统.Base.app_base import * from app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化设备1的adb连接") STEP(1, "初始化设备1的adb连接")
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
from 预定系统.Base.app_base import * from app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
from appium.webdriver.common.appiumby import AppiumBy from appium.webdriver.common.appiumby import AppiumBy
from 预定系统.Base.app_base import *
import logging import logging
from time import sleep from time import sleep
import sys
import os
# 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
base_path = os.path.abspath(base_path)
base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from app_base import *
# 配置日志记录 # 配置日志记录
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
from 预定系统.Base.app_base import * from app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化设备adb连接") STEP(1, "初始化设备adb连接")
......
from 预定系统.Base.app_base import *
from 预定系统.Base.base import *
import logging import logging
from time import sleep from time import sleep
import sys
import os
# 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
base_path = os.path.abspath(base_path)
base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from app_base import *
from base import *
# 配置日志记录 # 配置日志记录
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
from app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from app_base import *
from base import *
class XFMeeting: class XFMeeting:
tags = ['展厅巡检','讯飞测试','展厅讯飞转录流程测试'] tags = ['展厅巡检','讯飞测试','展厅讯飞转录流程测试']
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
from app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 兼容 PyInstaller 打包后的路径
# 获取当前脚本的绝对路径 if hasattr(sys, '_MEIPASS'):
current_dir = os.path.dirname(os.path.abspath(__file__)) base_path = sys._MEIPASS
# 构建预定系统的绝对路径 else:
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# 添加路径
sys.path.append(预定系统_path) base_path = os.path.abspath(base_path)
# 导入模块 base_base_path = os.path.join(base_path, 'Base')
from 预定系统.Base.base import * if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
class Operation_maintenance_0001: class Operation_maintenance_0001:
tags = ['展厅巡检','运维系统巡检'] tags = ['展厅巡检','运维系统巡检']
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
class UnifiedPlatform: class UnifiedPlatform:
tags = ['展厅巡检','统一平台系统巡检'] tags = ['展厅巡检','统一平台系统巡检']
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
from 预定系统.Base.app_base import * from app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from appium.webdriver.common.appiumby import AppiumBy from appium.webdriver.common.appiumby import AppiumBy
from 预定系统.Base.app_base import *
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from app_base import *
from base import *
class UnifiedPlatformTerminal: class UnifiedPlatformTerminal:
tags = ['统一平台终端入会'] tags = ['统一平台终端入会']
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
from 预定系统.Base.app_base import * from app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
from time import sleep from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
from app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from app_base import *
from base import *
class MeetingTableCard: class MeetingTableCard:
tags = ['展厅巡检','桌牌测试'] tags = ['展厅巡检','桌牌测试']
......
from 预定系统.Base.app_base import *
from 预定系统.Base.base import *
import logging import logging
from time import sleep from time import sleep
import sys
import os
# 兼容 PyInstaller 打包后的路径
if hasattr(sys, '_MEIPASS'):
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
base_path = os.path.abspath(base_path)
base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from app_base import *
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from venv import logger from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
try: try:
from 预定系统.Base.base import * from base import *
from 预定系统.Base.app_base import * from app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化设备adb连接") STEP(1, "初始化设备adb连接")
......
from 预定系统.Base.base import fetch_and_parse_check_txt
if __name__ == "__main__":
# 使用示例
# url = "https://192.168.5.218:8443/media/file/check.txt"
# save_directory = r"D:\GithubData\自动化\ubains-module-test\预定系统\reports" # 指定保存目录
# filename = "check.txt"
# download_file(url, save_directory, filename)
# 使用示例
url = "https://192.168.5.218:8443/media/file/check.txt"
save_path = "check.txt"
extract_info = ['[m]ysql', '[r]edis', '[f]dfs_storaged', '[f]dfs_tracker', '[e]mqx',
'ubains-meeting-api-1.0-SNAPSHOT.jar', 'ubains-meeting-inner-api-1.0-SNAPSHOT.jar', 'uwsgi']
info = fetch_and_parse_check_txt(url, save_path, extract_info)
if info:
for key, value in info.items():
print(f"{key} 服务的状态是 {value}")
else:
print("无法获取或解析文件内容")
\ No newline at end of file
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from time import sleep from time import sleep
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
try: base_base_path = os.path.join(base_path, 'Base')
from 预定系统.Base.base import * if base_base_path not in sys.path:
except ModuleNotFoundError as e: sys.path.insert(0, base_base_path)
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入") from base import *
from 预定系统.Base.base import *
DEFAULT_WAIT_TIME = 20 DEFAULT_WAIT_TIME = 20
# 默认等待时间(秒),用于元素加载或操作之间的等待 # 默认等待时间(秒),用于元素加载或操作之间的等待
......
import sys import sys
import os import os
from hytest import *
# 获取当前脚本的绝对路径 # 获取 Base 目录的绝对路径,并加入 sys.path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 base_dir = os.path.abspath(os.path.join(current_dir, '..', '..', 'Base'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..')) if base_dir not in sys.path:
# 添加路径 print(f"Adding Base directory to sys.path: {base_dir}")
sys.path.append(预定系统_path) sys.path.insert(0, base_dir)
# 导入模块
from 预定系统.Base.base import * try:
from base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
def suite_setup(): def suite_setup():
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
from 预定系统.Base.base import * base_base_path = os.path.join(base_path, 'Base')
if base_base_path not in sys.path:
sys.path.insert(0, base_base_path)
from base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
from hytest import * from hytest import *
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
try: base_base_path = os.path.join(base_path, 'Base')
from 预定系统.Base.Mqtt_Send import * if base_base_path not in sys.path:
except ModuleNotFoundError as e: sys.path.insert(0, base_base_path)
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入") from Mqtt_Send import *
from 预定系统.Base.Mqtt_Send import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
import sys import sys
import os import os
# 获取当前脚本的绝对路径 # 兼容 PyInstaller 打包后的路径
current_dir = os.path.dirname(os.path.abspath(__file__)) if hasattr(sys, '_MEIPASS'):
# 构建预定系统的绝对路径 base_path = sys._MEIPASS
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) else:
# 添加路径 base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(预定系统_path)
# 导入模块 base_path = os.path.abspath(base_path)
try: base_base_path = os.path.join(base_path, 'Base')
from 预定系统.Base.Mqtt_Send import * if base_base_path not in sys.path:
except ModuleNotFoundError as e: sys.path.insert(0, base_base_path)
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入") from Mqtt_Send import *
from 预定系统.Base.Mqtt_Send import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论