Tro*_*ski 5 python pytest jenkins
我正在尝试将 pytests 集成到我的 Jenkins 项目中,但 Jenkins 工作无法完成,因为 pytest 的测试会话尚未结束。
\n\n这是我能想到的最简单的例子:
\n\nPython测试:
\n\nimport pytest\nimport sys, time\nsys.path.append(\'../../bindings/python\')\n\nclass TestControl():\n def test_sanity_check(self):\n """\n Basic Test\n """\n assert (True)\nRun Code Online (Sandbox Code Playgroud)\n\n控制台命令和输出:
\n\n python git:(ed25b33) \xe2\x9c\x97 sudo nano test_control.py \n\xe2\x9e\x9c python git:(ed25b33) \xe2\x9c\x97 sudo python3 -m pytest -s test_control.py::TestControl::test_sanity_check\n=============================================================================================================================== test session starts ===============================================================================================================================\nplatform linux -- Python 3.4.3, pytest-3.3.2, py-1.5.2, pluggy-0.6.0\nrootdir: /var/lib/jenkins/workspace/examples/python, inifile:\ncollected 1 item \n\ntest_control.py . [100%]\n\n============================================================================================================================ 1 passed in 0.67 seconds =============================================================================================================================\nRun Code Online (Sandbox Code Playgroud)\n\n测试显示 100% 已完成,但由于某种原因并未终止会话。我尝试在脚本中添加 sys.exit() 但会导致错误。我只需要测试来释放控制台,这样我的 Jenkins 工作就可以完成。
\n