
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

import unittest

import util_tests
import jsonpickle_test
import thirdparty_tests

def suite():
    suite = unittest.TestSuite()
    suite.addTest(util_tests.suite())
    suite.addTest(jsonpickle_test.suite())
    suite.addTest(thirdparty_tests.suite())
    return suite

def main():
    #unittest.main(defaultTest='suite')
    unittest.TextTestRunner(verbosity=2).run(suite())

if __name__ == '__main__':
    main()


import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

import unittest

import util_tests
import jsonpickle_test
import thirdparty_tests

def suite():
    suite = unittest.TestSuite()
    suite.addTest(util_tests.suite())
    suite.addTest(jsonpickle_test.suite())
    suite.addTest(thirdparty_tests.suite())
    return suite

def main():
    #unittest.main(defaultTest='suite')
    return unittest.TextTestRunner(verbosity=2).run(suite())

if __name__ == '__main__':
    sys.exit(not main().wasSuccessful())

Return correct status code to shell when tests fail.
Return correct status code to shell when tests fail.

When tests fail (due to e.g. missing feedparser), then the exit code of tests/runtests.py is 0, which is treated by shell as
success.  Patch by Arfrever Frehtes Taifersar Arahesis.

  
  import os
  import sys
  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
  
  import unittest
  
  import util_tests
  import jsonpickle_test
  import thirdparty_tests
  
  def suite():
      suite = unittest.TestSuite()
      suite.addTest(util_tests.suite())
      suite.addTest(jsonpickle_test.suite())
      suite.addTest(thirdparty_tests.suite())
      return suite
  
  def main():
      #unittest.main(defaultTest='suite')
-     unittest.TextTestRunner(verbosity=2).run(suite())
+     return unittest.TextTestRunner(verbosity=2).run(suite())
  
  if __name__ == '__main__':
-     main()
+     sys.exit(not main().wasSuccessful())
  
Return correct status code to shell when tests fail.
## Code Before:

import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

import unittest

import util_tests
import jsonpickle_test
import thirdparty_tests

def suite():
    suite = unittest.TestSuite()
    suite.addTest(util_tests.suite())
    suite.addTest(jsonpickle_test.suite())
    suite.addTest(thirdparty_tests.suite())
    return suite

def main():
    #unittest.main(defaultTest='suite')
    unittest.TextTestRunner(verbosity=2).run(suite())

if __name__ == '__main__':
    main()

## Instruction:
Return correct status code to shell when tests fail.
## Code After:

import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

import unittest

import util_tests
import jsonpickle_test
import thirdparty_tests

def suite():
    suite = unittest.TestSuite()
    suite.addTest(util_tests.suite())
    suite.addTest(jsonpickle_test.suite())
    suite.addTest(thirdparty_tests.suite())
    return suite

def main():
    #unittest.main(defaultTest='suite')
    return unittest.TextTestRunner(verbosity=2).run(suite())

if __name__ == '__main__':
    sys.exit(not main().wasSuccessful())
