changeset 524:317a052f9b14

better main, allow to debug in a debugger.
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Fri, 14 Nov 2008 16:46:03 -0500
parents 111e547ffa7b
children 82da179d95b2
files _test_linear_regression.py
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/_test_linear_regression.py	Fri Nov 14 16:39:59 2008 -0500
+++ b/_test_linear_regression.py	Fri Nov 14 16:46:03 2008 -0500
@@ -21,5 +21,18 @@
         print 'mse = ',mse
         
 if __name__ == '__main__':
-    unittest.main()
-        
+    import sys
+
+    if len(sys.argv)==1:
+        unittest.main()
+    else:
+        assert sys.argv[1]=="--debug"
+        tests = []
+        for arg in sys.argv[2:]:
+            tests.append(arg)
+        if tests:
+            unittest.TestSuite(map(T_DataSet, tests)).debug()
+        else:
+            module = __import__("_test_linear_regression")
+            tests = unittest.TestLoader().loadTestsFromModule(module)
+            tests.debug()