运行生成时,我一直收到一个错误。詹金斯的py.tests:
jenkins执行shell:
#!/bin/sh
py.test tests || true它开始了。当它完成后,我看到了下一个日志:
Started by user manny
Building in workspace /var/lib/jenkins/workspace/web-services tests
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://example.git # timeout=10
Fetching upstream changes from https://example.org/m.git
...
...
[web-services tests] $ /bin/sh /tmp/hudson1759686215204688979.sh
============================= test session starts ==============================
platform linux -- Python 3.5.1, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /var/lib/jenkins/workspace/web-services tests/tests, inifile:
plugins: asyncio-0.3.0
collected 99 items / 4 errors
tests/bll/test_action_manager.py ...... //here goes list of tests
...
===== 3 failed, 75 passed, 1 skipped, 20 xfailed, 4 error in 76.85 seconds =====
Finished: SUCCESS詹金斯通知斯拉克:
web-services tests - #44 Back to normal after 19 min (</job/web-services%20tests/44/|Open>)
No Tests found.没有检测结果。怎么修呢?
发布于 2016-08-02 11:15:31
从日志中,我们可以看到python脚本失败了。
collected 99 items / 4 errors
从Jenkins的角度来看,如果遇到任何错误,它将导致失败,因为Jenkins默认使用/bin/sh -xe。
因此,通过在调用python脚本之前添加#!/bin/sh,可能有助于解决这个问题:
#!/bin/sh
py.test tests发布于 2016-08-02 10:59:01
Jenkins根据退出代码标记构建成功/失败。0代表成功,否则失败。
当没有错误时,Py.Test的外部代码为0。当有一个或更多的错误,而不是0(也许1,不知道确切)。
解决方案:
'your command || true'发布于 2016-08-02 10:56:45
手动运行相同的测试(在Jenkins之外)并检查那里的错误。测试集合可能是一个问题,或者仅仅是测试失败本身。
另外:请张贴完整的日志,这样我们才能更好地检查到底发生了什么。
https://stackoverflow.com/questions/38718364
复制相似问题