pytest测试失败时如何使Jenkins构建失败

时间:2019-06-17 18:50:18

标签: python jenkins pytest

这是我的示例测试代码。当我在3.6之前的python版本中运行此命令时,由于类型检查周围的语法错误,测试失败。

这是错误

============================= test session starts ==============================
platform linux -- Python 3.5.2, pytest-4.0.2, py-1.8.0, pluggy-0.12.0
collected 0 items / 1 errors

==================================== ERRORS ====================================
_____________________ ERROR collecting test/test_status.py _____________________
lib/lib/python3.5/site-packages/_pytest/python.py:450: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
lib/lib/python3.5/site-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
E     File "/home/jenkins-slave/workspace/.../test/test_status.py", line 11
E       test_client: FlaskClient = app.test_client()
E                  ^
E   SyntaxError: invalid syntax
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.14 seconds ============================

该测试失败时,如何使Jenkins构建失败?

0 个答案:

没有答案