Return an error exit status if not all tests passes.
This commit is contained in:
Alexandre Vassalotti 2007-12-08 04:49:22 +00:00
parent 901464f131
commit d8a8c7d8d7
1 changed files with 6 additions and 3 deletions

View File

@ -2657,12 +2657,15 @@ def _test():
sys.path.insert(0, dirname)
m = __import__(filename[:-3])
del sys.path[0]
testmod(m)
failures, _ = testmod(m)
else:
testfile(filename, module_relative=False)
failures, _ = testfile(filename, module_relative=False)
if failures:
return 1
else:
r = unittest.TextTestRunner()
r.run(DocTestSuite())
return 0
if __name__ == "__main__":
_test()
sys.exit(_test())