tests.py 938B

1234567891011121314151617181920212223242526
  1. import unittest
  2. """
  3. python3.4 -m unittest /home/bux/Projets/socialintengine/intelligine/tests/simulation/mode/TestChangeMode.py && python3.4 -m unittest intelligine/tests/simulation/pheromone/TestDirection.py
  4. """
  5. test_modules = [
  6. 'intelligine.tests.simulation.mode.TestChangeMode.TestChangeMode',
  7. 'intelligine.tests.simulation.pheromone.TestDirection.TestDirection',
  8. ]
  9. suite = unittest.TestSuite()
  10. for t in test_modules:
  11. try:
  12. # If the module defines a suite() function, call it to get the suite.
  13. mod = __import__(t, globals(), locals(), ['suite'])
  14. suitefn = getattr(mod, 'suite')
  15. suite.addTest(suitefn())
  16. except (ImportError, AttributeError):
  17. # else, just load all the test cases from the module.
  18. suite.addTest(unittest.defaultTestLoader.loadTestsFromName(t))
  19. test_result = unittest.TextTestRunner().run(suite)
  20. if test_result.failures or test_result.errors:
  21. exit(1)