[Erp5-report] r16640 - /erp5/trunk/products/ERP5Type/tests/runUnitTest.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Sep 27 05:45:40 CEST 2007


Author: yo
Date: Thu Sep 27 05:45:39 2007
New Revision: 16640

URL: http://svn.erp5.org?rev=16640&view=rev
Log:
Patch profiler instead of unittest, because we use the profiler.

Modified:
    erp5/trunk/products/ERP5Type/tests/runUnitTest.py

Modified: erp5/trunk/products/ERP5Type/tests/runUnitTest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/runUnitTest.py?rev=16640&r1=16639&r2=16640&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/runUnitTest.py (original)
+++ erp5/trunk/products/ERP5Type/tests/runUnitTest.py Thu Sep 27 05:45:39 2007
@@ -251,15 +251,16 @@
   
   suite = ERP5TypeTestLoader(save=save).loadTestsFromNames(test_list)
 
-  # Hack the TestCase to run only specified test methods.
+  # Hack the profiler to run only specified test methods.
   run_only = os.environ.get('run_only')
   if run_only:
     test_method_list = run_only.split(',')
-    run_orig = unittest.TestCase.run
-    def run(self, **kw):
-      if id(self).rsplit('.', 1)[-1] in test_method_list:
-        return run_orig(self, **kw)
-    unittest.TestCase.run = run
+    from Testing.ZopeTestCase import profiler
+    run_orig = profiler.Profiled.__call__
+    def run(self, *args, **kw):
+      if self.id().rsplit('.', 1)[-1] in test_method_list:
+        return run_orig(self, *args, **kw)
+    profiler.Profiled.__call__ = run
 
   # change current directory to the test home, to create zLOG.log in this dir.
   os.chdir(tests_home)
@@ -331,7 +332,7 @@
       os.environ["erp5_load_data_fs"] = "1"
     elif opt == "--erp5_catalog_storage":
       os.environ["erp5_catalog_storage"] = arg
-    elif opt == "--run-only":
+    elif opt == "--run_only":
       os.environ["run_only"] = arg
 
   test_list = args




More information about the Erp5-report mailing list