小编W.D*_*ian的帖子

如何在gitlab-ci上获取unittest测试结果?

使用gitlab-runner执行python unittest后,testcase失败,但是gitlab显示pass。

$ python3 test/test_utils.py
test_init (__main__.Test_BslReset) ... ERROR
test_reset_all (__main__.Test_BslReset) ... ERROR

======================================================================
ERROR: test_init (__main__.Test_BslReset)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_utils.py", line 9, in setUp
    self.bsl_reset = common.utils.BslReset()
  File "/home/gitlab-runner/builds/FgNVsWZq/0/root/hddl-r-sanity/common/utils.py", line 119, in __init__
    self.bsl_reset_src = os.path.join(get_hddl_install_dir(), 'hddl-bsl')
  File "/home/gitlab-runner/builds/FgNVsWZq/0/root/hddl-r-sanity/common/utils.py", line 65, in get_hddl_install_dir
    raise ValueError('Not check EnvVar(HDDL_INSTALL_DIR),Please set it!')
ValueError: Not check EnvVar(HDDL_INSTALL_DIR),Please set it!

======================================================================
ERROR: test_reset_all (__main__.Test_BslReset)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_utils.py", line 9, in setUp
    self.bsl_reset = common.utils.BslReset()
  File …
Run Code Online (Sandbox Code Playgroud)

python-unittest gitlab-ci gitlab-ci-runner python-3.7

5
推荐指数
2
解决办法
1万
查看次数