diff _test_dataset.py @ 350:ae6605eccd09

Can give test name in debug mode. This will execute on the gived test name.
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Tue, 17 Jun 2008 16:20:17 -0400
parents 2174fe5cc7d0
children cefa8518ff48
line wrap: on
line diff
--- a/_test_dataset.py	Tue Jun 17 16:09:59 2008 -0400
+++ b/_test_dataset.py	Tue Jun 17 16:20:17 2008 -0400
@@ -663,14 +663,19 @@
         res = dsc[:]
 
 if __name__=='__main__':
-    if len(sys.argv)==2:
-        if sys.argv[1]=="--debug":
+    tests = [] #'test_RenamedFieldsDataSet']
+#    unittest.TestSuite(map(T_DataSet, tests)).debug()
+#    sys.exit()
+    debug=False
+    if len(sys.argv)==1:
+        unittest.main()
+    else:
+        assert sys.argv[1]=="--debug"
+        for arg in sys.argv[2:]:
+            tests.append(arg)
+        if tests:
+            unittest.TestSuite(map(T_DataSet, tests)).debug()
+        else:
             module = __import__("_test_dataset")
             tests = unittest.TestLoader().loadTestsFromModule(module)
             tests.debug()
-        print "bad argument: only --debug is accepted"
-    elif len(sys.argv)==1:
-        unittest.main()
-    else:
-        print "bad argument: only --debug is accepted"
-