Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

单元测试失败时exit code依然为0 #141

Open
zxc0328 opened this issue Jun 6, 2017 · 0 comments
Open

单元测试失败时exit code依然为0 #141

zxc0328 opened this issue Jun 6, 2017 · 0 comments
Assignees
Labels

Comments

@zxc0328
Copy link
Member

zxc0328 commented Jun 6, 2017

在CI中,如果测试失败,CI依然会通过。问题在于没有把测试结果码传入进程的exit调用。

解决:

在manage.py中调用test时:

@manager.command
def test() :
    import unittest
    tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)

TextTestRunner的run之后应该会返回一个结果代码。这个代码应该作为system.exit的参数被传进去。具体可以看这里

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants