- 系统: win10
- python版本:3.11.7
- minium版本:1.4.6
- 微信开发工具版本:1.06.2310080
运行minitest官网的一个简单例子,内容如下
#!/usr/bin/env python3
import minium
class FirstTest(minium.MiniTest):
def test_get_system_info(self):
sys_info = self.mini.get_system_info()
self.assertIn("SDKVersion", sys_info)
minitest -m test.first_test -c config.json -g
运行结果报以下错误:
====================case num:1, failed num:0, error num:1====================
FirstTest:test_get_system_info has error:
Traceback (most recent call last):
File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\minium\framework\libs\unittest\case.py", line 42, in testPartExecutor
yield
File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\minium\framework\libs\unittest\case.py", line 117, in run
self._miniSetUp()
File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\minium\framework\minitest.py", line 416, in _miniSetUp
self.app.go_home()
File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\minium\miniprogram\base_driver\minium_log.py", line 172, in wrapper
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\minium\miniprogram\base_driver\app.py", line 837, in go_home
page = self.switch_tab(
^^^^^^^^^^^^^^^^
File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\minium\miniprogram\base_driver\minium_log.py", line 172, in wrapper
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\minium\utils\utils.py", line 82, in wrapper
ret = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\minium\miniprogram\base_driver\app.py", line 767, in switch_tab
page = self._change_route_async(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\minium\miniprogram\base_driver\app.py", line 933, in _change_route_async
cmd.get_open_result(wait_timeout)
File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\minium\miniprogram\base_driver\app.py", line 128, in get_open_result
return self._open_callback.get_result()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\minium\miniprogram\base_driver\callback.py", line 152, in get_result
return self._waiter.result()
^^^^^^^^^^^^^^^^^^^^^
minium.framework.exception.MiniCommandError: timeout
最后提取重点错误为
minium.framework.exception.MiniCommandError: timeout
将此错误去网上查一下查,我这里用的bing,看有没有收获
查到一个minium.framework.exception.MiniCommandError? | 微信开放社区 (qq.com) 给出的方案是降低微信版本
还查到一个小程序云测 minium 开发工具调试总是报错呢? | 微信开放社区 (qq.com) 云测官网也说1.06.2310080版本有问题,需要回退
所以这里尝试回退版本到1.06.2308300,方法为去官网下载然后安装
官网地址:微信开发者工具1.06.2308300 Stable 更新说明 | 微信开放社区 (qq.com)
安装完成后打开开发工具,并在命令行重新运行代码
minitest -m test.first_test -c config.json -g
此时运行结果正常,测试代码运行成功,显示如下:
[I 2023-12-18 10:15:45 minium minitest#424 _miniSetUp] =========case: test_get_system_info start=========
[D 2023-12-18 10:15:45 minium.Conn4128 connection#417 _safely_send] SEND > {"id":"33e7dcb5-87c0-4c7c-bf3e-9caa432aaa15","method":"App.callWxMethod","params":{"method":"getSystemInfoSync","args":[]}}
[D 2023-12-18 10:15:45 minium.Conn4128 connection#651 __on_message] RECV < {"id":"33e7dcb5-87c0-4c7c-bf3e-9caa432aaa15","result":{"result":{"model":"iPhone X","pixelRatio":3,"windowWidth":375,"windowHeight":812,"system":"iOS 10.0.1","language":"zh_CN","version":"8.0.5","deviceOrientation":"portrait","screenWidth":375,"screenHeight":812,"SDKVersion":"3.1.5","brand":"devtools","fontSizeSetting":16,"benchmarkLevel":1,"batteryLevel":100,"statusBarHeight":44,"bluetoothEnabled":true,"locationEnabled":true,"wifiEnabled":true,"cameraAuthorized":true,"locationAuthorized":true,"microphon...
[I 2023-12-18 10:15:45 minium minitest#717 capture] capture assertIn-success.png
[I 2023-12-18 10:15:45 minium basenative#25 wrapper] call IdeNative.screen_shot
[D 2023-12-18 10:15:45 minium.Conn4128 connection#417 _safely_send] SEND > {"id":"2aa2b00e-1815-4a6b-a527-8cd122049c62","method":"App.captureScreenshot","params":{}}
[D 2023-12-18 10:15:45 minium.Conn4128 connection#651 __on_message] RECV < {"id":"2aa2b00e-1815-4a6b-a527-8cd122049c62","result":{"data":"iVBORw0KGgoAAAANSUhEUgAAAXcAAAMsCAIAAAAgdHW0AAAAAXNSR0IArs4c6QAAIABJREFUeJzsvWmsZdeV3/dfa+99zrnTm+pVFVmcJFIlUoO7291sDx0SjbRj54MgBOigiWYMGDBgQ4KDeAhlBQkCNSQgg5mm3QjiQAIMG+jAkcEECRKjHSB2DAiSE3c3u9WaKVIlihRZc9Wb7nCGvdfKh33ufffNQ71b71Xp/EAU77v3nnPPPffs/1l7rbXXIv27j6KhoaFhZvBpH0BDQ8NDTqMyDQ0Ns6VRmYaGhtnSqExDQ8NsaVSmoaFhtjQq09DQMFsalWloaJgtjco0NDTMlkZlGhoaZkujMg0NDbOlUZmGhobZ0qhMQ0PDbGlUpqGhYbY0KtPQ0DBbGpVpaGiYLY3KNDQ0zJZGZRoaGmZLozINDQ2zpVGZhoaG2d...
[I 2023-12-18 10:15:45 minium basenative#29 wrapper] call IdeNative.screen_shot end
[D 2023-12-18 10:15:45 minium minitest#620 _miniTearDown] =========Current case Down: test_get_system_info=========
[I 2023-12-18 10:15:45 minium minitest#717 capture] capture teardown.png
[I 2023-12-18 10:15:45 minium basenative#25 wrapper] call IdeNative.screen_shot
[D 2023-12-18 10:15:45 minium.Conn4128 connection#417 _safely_send] SEND > {"id":"bc81e85c-6f26-43ea-91fa-7d11abb436e7","method":"App.captureScreenshot","params":{}}
[D 2023-12-18 10:15:45 minium.Conn4128 connection#651 __on_message] RECV < {"id":"bc81e85c-6f26-43ea-91fa-7d11abb436e7","result":{"data":"iVBORw0KGgoAAAANSUhEUgAAAXcAAAMsCAIAAAAgdHW0AAAAAXNSR0IArs4c6QAAIABJREFUeJzsvWmsZdeV3/dfa+99zrnTm+pVFVmcJFIlUoO7291sDx0SjbRj54MgBOigiWYMGDBgQ4KDeAhlBQkCNSQgg5mm3QjiQAIMG+jAkcEECRKjHSB2DAiSE3c3u9WaKVIlihRZc9Wb7nCGvdfKh33ufffNQ71b71Xp/EAU77v3nnPPPffs/1l7rbXXIv27j6KhoaFhZvBpH0BDQ8NDTqMyDQ0Ns6VRmYaGhtnSqExDQ8NsaVSmoaFhtjQq09DQMFsalWloaJgtjco0NDTMlkZlGhoaZkujMg0NDbOlUZmGhobZ0qhMQ0PDbGlUpqGhYbY0KtPQ0DBbGpVpaGiYLY3KNDQ0zJZGZRoaGmZLozINDQ2zpVGZhoaG2d...
[I 2023-12-18 10:15:45 minium basenative#29 wrapper] call IdeNative.screen_shot end
[I 2023-12-18 10:15:45 minium basenative#25 wrapper] call BaseNative.get_start_up
[I 2023-12-18 10:15:45 minium basenative#29 wrapper] call BaseNative.get_start_up end
====================case num:1, failed num:0, error num:0====================
此时运行以下命令,也可以看到运行结果:
python3 -m http.server 12345 -d outputs
打开 localhost:12345,显示如下:
测试用例最后成功运行。
总结:开发工具1.06.2310080版有问题,将开发工具回退到上一版本即可解决。
标签:10,minium,微信,45,2023,报错,18,packages From: https://www.cnblogs.com/zhaoguowei12/p/17928477.html