如何使用pytest_embedded进行测试

Danmar
Posts: 1
Joined: Thu Jun 06, 2024 8:58 am

如何使用pytest_embedded进行测试

Postby Danmar » Thu Jun 06, 2024 9:37 am

在参考了https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32s3/contribute/esp-idf-tests-with-pytest.html这个文档和手动尝试以后,我仍然无法成功允许example中的测试脚本

环境:win11,vscode,esp-idf插件,5.2.1 release
install.bat --enable-pytest 正常执行

测试有:
1:使用实际产品的板子,芯片是esp32s3,尝试了console这个案例,执行pytest .\pytest_console.py 后立即显示第一个测试失败,后面超时全部失败
2:使用esp32c3 wroom kit,尝试了hello_world示例, pytest -s .\pytest_hello_world.py 或 pytest -s .\pytest_hello_world.py --target esp32c3 都是一样的,立即显示第一个测试失败,后面超时全部失败
显然脚本没有读取到idf监视器输出的日志
所有的尝试在使用idf监视器时都是正常打印日志的,烧写固件都是正常的

我对pytest_embedded如何工作的有以下疑问
1:他会或者需要自动烧写固件吗
2:我知道它是基于串口的输入输出进行判断的,是否意味着只要idf监视器正常,他就可以正常工作

目前我的需求很简单:
1:启动2s内打印system init success
2:启动30s内打印got ip:xxxx
3:在打印uart485_read:时,2s内打印uart485 read ok
4:保存串口日志用于报错时分析

请帮助我解决这个问题

另外:
在这个链接中,我尝试idf.py -T all build是报错的,提示Error: No such option: -T
https://docs.espressif.com/projects/esp ... s.html#id5
Attachments
pytest pytest_console.py.txt
(46.17 KiB) Downloaded 29 times
pytest -s pytest_hello_world.py.txt
(17.22 KiB) Downloaded 30 times
install.bat --enable-pytest.txt
(23.2 KiB) Downloaded 33 times

Who is online

Users browsing this forum: No registered users and 138 guests