Commit b2120487 by linguangwei

添加本地文件路径区分mac/windows

parent 46dd17ec
...@@ -6,7 +6,8 @@ browserName = Chrome ...@@ -6,7 +6,8 @@ browserName = Chrome
[testServer] [testServer]
#调试客户端本地文件路径 #调试客户端本地文件路径
app_location = C:\Users\Administrator\AppData\Local\Programs\xmqxy\小麦企学院.exe win_app_location = C:\Users\Administrator\AppData\Local\Programs\xmqxy\小麦企学院.exe
mac_app_location = C:\Users\Administrator\AppData\Local\Programs\xmqxy\小麦企学院
[account] [account]
# 白名单账号 # 白名单账号
......
import configparser import configparser
import os import os
import platform
config = configparser.ConfigParser() config = configparser.ConfigParser()
...@@ -9,12 +10,18 @@ config.read(dir + "/config/config.ini", encoding='utf-8') ...@@ -9,12 +10,18 @@ config.read(dir + "/config/config.ini", encoding='utf-8')
# 根据配置文件获取测试url # 根据配置文件获取测试url
def test_location(): def test_location():
location = config.get("testServer", "app_location") current_platform = platform.system().lower()
if current_platform == "windows":
location = config.get("testServer", "win_app_location")
return location
elif current_platform == "darwin":
location = config.get("testServer", "mac_app_location")
return location return location
def test_account(): def test_account():
return config.get("account", "username") return config.get("account", "username")
def test_password(): def test_password():
return config.get("account", "password") return config.get("account", "password")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment