执行httprunner脚本时出现如下错误
运行结果及报错内容
test2_test.py::TestCaseTest2::test_start
C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages_pytest\python.py:199: PytestReturnNotNoneWarning: Expected None, but test2_test.py::TestCaseTest2::test_start returned <Desktop.test2_test.TestCaseTest2 object at 0x0000027D9C3CBF40>, which will be an error in a future version of pytest. Did you mean to use assert
instead of return
?
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
期望用例执行成功,可以查看报告
看一下你的报错意思:
test2_test.py::测试用例测试2::测试开始
C: \Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages_pytest\Python.py:199:PytestReturnNotNoneWarning:应为None,但test2_test.py::TestCaseTest2::test_start在0x0000027D9C3CBF40返回了<Desktop.test2_testTestCasetest2对象,这将是pytest未来版本中的错误。您是否打算使用assert而不是return?
警告.警告(
--文件:https://docs.pytest.org/en/stable/how-to/capture-warnings.html
这里的意思就是你在执行用例,执行结果应为None,但实际返回了结果,给你发出警告,提示你【您是否打算使用assert而不是return?】