Browse Source

add tests launcher

Bastien Sevajol 9 years ago
parent
commit
23cbcc4ac8
1 changed files with 26 additions and 0 deletions
  1. 26 0
      tests.py

+ 26 - 0
tests.py View File

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