未验证 提交 727eb1a2 编写于 作者: C Cleber Rosa

Merge remote-tracking branch 'ldoktor/travis-selftest-verbosity'

Signed-off-by: NCleber Rosa <crosa@redhat.com>
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
__author__ = 'Lucas Meneghel Rodrigues <lmr@redhat.com>' __author__ = 'Lucas Meneghel Rodrigues <lmr@redhat.com>'
import os import os
import subprocess
import sys import sys
import logging import logging
import unittest import unittest
...@@ -28,16 +29,23 @@ def test_suite(): ...@@ -28,16 +29,23 @@ def test_suite():
class MyResult(unittest.TextTestResult): class MyResult(unittest.TextTestResult):
def startTest(self, test): def stopTest(self, test):
# Destroy the data_dir.get_tmpdir # stopTest
ret = super(MyResult, self).stopTest(test)
# Destroy the data_dir.get_tmpdir ...
data_dir._tmp_tracker.unittest_refresh_dir_tracker() data_dir._tmp_tracker.unittest_refresh_dir_tracker()
assert os.system(CHECK_TMP_DIRS) == 0, "Previous test left some dirs behind" # ... and check whether some dirs were left behind
return super(MyResult, self).startTest(test) dir_check = subprocess.Popen([CHECK_TMP_DIRS], stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
if dir_check.wait():
raise AssertionError("Test %s left some tmp files behind:\n%s"
% (test, dir_check.stdout.read()))
return ret
if __name__ == '__main__': if __name__ == '__main__':
runner = unittest.TextTestRunner(failfast=not os.environ.get("SELF_CHECK_CONTINUOUS"), runner = unittest.TextTestRunner(failfast=not os.environ.get("SELF_CHECK_CONTINUOUS"),
verbosity=2, resultclass=MyResult) verbosity=1, resultclass=MyResult)
result = runner.run(test_suite()) result = runner.run(test_suite())
if result.failures or result.errors: if result.failures or result.errors:
sys.exit(1) sys.exit(1)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册