WebsocketTest 1.0.18__py3-none-any.whl → 1.0.19__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,16 +108,14 @@ def install_allure():
108
108
  # os.chmod(os.path.join(ALLURE_BIN_DIR, "allure"), 0o755)
109
109
 
110
110
  # 更新PATH
111
- # if add_to_user_path(ALLURE_BIN_DIR):
112
- # # 立即在当前进程生效
113
- # os.environ["PATH"] = f"{ALLURE_BIN_DIR}{os.pathsep}{os.environ.get('PATH', '')}"
114
-
111
+ add_to_user_path(ALLURE_BIN_DIR)
115
112
  return True
116
113
  except Exception as e:
117
114
  print(f"❌ 安装失败: {type(e).__name__}: {e}", file=sys.stderr)
118
115
  return False
119
116
 
120
117
  def add_to_user_path(path):
118
+ path = os.path.normpath(path) # 规范化路径(去除多余的斜杠)
121
119
  """添加到用户级PATH环境变量"""
122
120
  try:
123
121
  if sys.platform == "win32":
@@ -129,22 +127,22 @@ def add_to_user_path(path):
129
127
  winreg.KEY_READ | winreg.KEY_WRITE,
130
128
  ) as key:
131
129
  current_path, _ = winreg.QueryValueEx(key, "Path")
132
-
133
130
  if path in current_path.split(os.pathsep):
131
+ print(f"⏩ path中路径已存在: {path}")
134
132
  return False
135
133
 
136
134
  new_path = f"{current_path}{os.pathsep}{path}" if current_path else path
137
135
  winreg.SetValueEx(key, "Path", 0, winreg.REG_EXPAND_SZ, new_path)
138
-
139
- # 刷新环境变量
136
+ # 刷新时只更新用户 PATH,不携带系统 PATH
140
137
  subprocess.run(
141
- 'powershell -command "[Environment]::SetEnvironmentVariable(\'Path\', $env:Path + \';{}\', \'User\')"'
142
- .format(path),
138
+ f'powershell -command "[Environment]::SetEnvironmentVariable(\'Path\', \'{new_path}\', \'User\')"',
143
139
  shell=True,
144
140
  check=True
145
141
  )
146
142
  print(f"✅ 已添加PATH: {path}")
147
143
  return True
144
+ except PermissionError:
145
+ print("❌ 需要管理员权限!")
148
146
  except Exception as e:
149
147
  print(f"⚠️ 添加PATH失败: {e}\n请手动添加 {path} 到环境变量", file=sys.stderr)
150
148
  return False
@@ -22,10 +22,11 @@ pip install WebsocketTest
22
22
  **3.安装allure 工具:**
23
23
  ```
24
24
  install-allure
25
+ <!-- 注:allure安装完,会自动配置环境变量,需要重启终端才能生效 -->
25
26
  ```
26
27
  **4.创建测试项目:**
27
28
  ```
28
- # 一次性操作,yourtestProject创建成功以后,测试直接cd到yourtestProject下,进行ws test
29
+ <!-- 一次性操作,yourtestProject创建成功以后,测试直接cd到yourtestProject下,进行ws test -->
29
30
  ws startproject yourtestProject
30
31
  cd yourtestProject
31
32
  ```
@@ -53,10 +54,10 @@ ws test --env live --app 66ba7ded --service gateway_5.0 --project svw
53
54
  <!-- 指定Gatewaycase -->
54
55
  ws test --env uat --app 3d7d3ea4 --service gateway_5.4 --project vwa --testcase testcase/test_all.py::TestGateway::test[case_suite0]
55
56
  <!-- 指定Aquacase -->
56
- ws test --env uat --app 0f0826ab --service aqua --project vwa testcase/test_all.py::TestAqua::test[case_suite0]
57
+ ws test --env uat --app 0f0826ab --service aqua --project vwa --testcase testcase/test_all.py::TestAqua::test[case_suite0]
57
58
  ```
58
59
 
59
- **6.其他:**
60
+ #### 其他
60
61
  ```
61
62
  <!-- 本地开发模式调试 -->
62
63
  pip install -e .
@@ -1,9 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: WebsocketTest
3
- Version: 1.0.18
3
+ Version: 1.0.19
4
4
  Summary: websocket api autotest
5
- Requires-Dist: allure_python_commons==2.13.5
6
- Requires-Dist: numpy==2.2.4
5
+ Requires-Dist: allure-pytest==2.13.5
7
6
  Requires-Dist: pandas==2.2.3
8
7
  Requires-Dist: pytest==8.2.2
9
8
  Requires-Dist: PyYAML==6.0.2
@@ -1,5 +1,5 @@
1
1
  WebsocketTest/__init__.py,sha256=u71SAVmbgsyp0K21kilo7pIDgeyxsaHAi93clC0OIPQ,556
2
- WebsocketTest/allure_installer.py,sha256=mqcEZQsVnqMHtkH_gdiKD4ibo49u7NpLqvME1rvxBtk,6819
2
+ WebsocketTest/allure_installer.py,sha256=q6d3dIJVeL6gFCyqVUAAIwtmDVuM2cFgOzEAU2BfCSY,6852
3
3
  WebsocketTest/cli.py,sha256=HcnjgRLM404fVszrSRAf7G1y9XLJ_ZetVtRIwavS4xE,987
4
4
  WebsocketTest/conftest.py,sha256=qFAgwWwi2_MjmN6LMlj_zk3XADcYqp2cr5t8qxYHF1g,1879
5
5
  WebsocketTest/run_tests.py,sha256=ippnfovdOn1vDxNWXMZTUsWYdT--4eAtfubv9qgsIRY,6063
@@ -16,7 +16,7 @@ WebsocketTest/common/assertUtils.py,sha256=poyL6J_WXb2BJvaABCILfiWHN7gHSTRcMWvpj
16
16
  WebsocketTest/common/logger.py,sha256=JY7dJLVObKoA6E-5FJ0EMX_EyN8Otg4_4FYywKVSkcg,367
17
17
  WebsocketTest/common/utils.py,sha256=29aylauHjrKrJ40PZAcgmikA7U9RJ_qQiX2vjIxsdnA,8748
18
18
  WebsocketTest/libs/allure-2.30.0.zip,sha256=SEc2gYElQbTQrIcpJ5gLIWptfPW8kPITU8gs4wezZho,26551281
19
- WebsocketTest/templates/basic/README.md,sha256=QMs4YT60mCOS7Q-VbUd_UcZa85pzg2SlJTT8Zjc_osQ,2818
19
+ WebsocketTest/templates/basic/README.md,sha256=3YJSUPSTxTYmJrUHvyCjFivK8XD-5FgvVainTVRdiaI,2927
20
20
  WebsocketTest/templates/basic/conftest.py,sha256=qFAgwWwi2_MjmN6LMlj_zk3XADcYqp2cr5t8qxYHF1g,1879
21
21
  WebsocketTest/templates/basic/pytest.ini,sha256=An32MB2Yy2L4EVP9WoczW8x0ISAXsgG0tlSLta-cDcs,589
22
22
  WebsocketTest/templates/basic/__pycache__/conftest.cpython-310-pytest-8.2.2.pyc,sha256=6XLNaJ6_0w_6zXPawybQR8yT1svXwLKlZehtjDtvm_A,1495
@@ -84,8 +84,8 @@ WebsocketTest/templates/basic/testcase/__pycache__/test_gateway.cpython-310-pyte
84
84
  WebsocketTest/templates/basic/testcase/__pycache__/test_gateway1.cpython-310-pytest-8.2.2.pyc,sha256=9_jiZtyNwQfXe-Jz1acHxrwz5snYfBngqgTFtIWhRNA,5684
85
85
  WebsocketTest/templates/basic/testcase/__pycache__/test_gatewaybak.cpython-310-pytest-8.2.2.pyc,sha256=L50gNeQvSuFq2e-arnmKqYJR75ZrThiVaiIow5UUTjo,5587
86
86
  WebsocketTest/templates/basic/testcase/__pycache__/test_limin.cpython-310-pytest-8.2.2.pyc,sha256=hx7j0GNxlgTscC36dUBHeo401Mo3bRt1cq6t7e7dDSA,3434
87
- websockettest-1.0.18.dist-info/METADATA,sha256=sGMYizgs4CjS4qwECOk5lHsO5OA8JfdjtcUTx7iIzbU,334
88
- websockettest-1.0.18.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
89
- websockettest-1.0.18.dist-info/entry_points.txt,sha256=r5FtB9A16mLy9v8B77rzZOxgn63ao8z4FTyvJ2KS3jo,108
90
- websockettest-1.0.18.dist-info/top_level.txt,sha256=2iF1gZSbXLjVFOe5ZKQiCLC1FzAwhcQUM88yGi-vrCU,14
91
- websockettest-1.0.18.dist-info/RECORD,,
87
+ websockettest-1.0.19.dist-info/METADATA,sha256=AvFUAKdICFII19SlBtfruhnbxwRZFy6BSua7SKfxQ98,297
88
+ websockettest-1.0.19.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
89
+ websockettest-1.0.19.dist-info/entry_points.txt,sha256=r5FtB9A16mLy9v8B77rzZOxgn63ao8z4FTyvJ2KS3jo,108
90
+ websockettest-1.0.19.dist-info/top_level.txt,sha256=2iF1gZSbXLjVFOe5ZKQiCLC1FzAwhcQUM88yGi-vrCU,14
91
+ websockettest-1.0.19.dist-info/RECORD,,