import unittest

if __name__ == '__main__':
    all_tests = unittest.TestLoader().discover('./', pattern='*_tests.py')
    unittest.TextTestRunner().run(all_tests)

import sys
import unittest

if __name__ == '__main__':
    all_tests = unittest.TestLoader().discover('./', pattern='*_tests.py')
    ret = unittest.TextTestRunner().run(all_tests).wasSuccessful()
    sys.exit(ret)

Fix an issue when unit tests always return 0 status.