[Zope3-checkins] SVN: zope.testing/branches/benji-parallelize-subprocesses/src/zope/testing/testrunner/ work around bug in the way default options are handled; fix will hopefully soon

Benji York benji at zope.com
Thu Jul 10 21:56:33 EDT 2008


Log message for revision 88221:
  work around bug in the way default options are handled; fix will hopefully soon
  appear on the trunk
  

Changed:
  U   zope.testing/branches/benji-parallelize-subprocesses/src/zope/testing/testrunner/options.py
  U   zope.testing/branches/benji-parallelize-subprocesses/src/zope/testing/testrunner/runner.py

-=-
Modified: zope.testing/branches/benji-parallelize-subprocesses/src/zope/testing/testrunner/options.py
===================================================================
--- zope.testing/branches/benji-parallelize-subprocesses/src/zope/testing/testrunner/options.py	2008-07-11 01:54:48 UTC (rev 88220)
+++ zope.testing/branches/benji-parallelize-subprocesses/src/zope/testing/testrunner/options.py	2008-07-11 01:56:33 UTC (rev 88221)
@@ -414,7 +414,7 @@
 """)
 
 other.add_option(
-    '-j', action="store", type="int", dest='processes', default=1,
+    '-j', action="store", type="int", dest='processes',
     help="""\
 Use up to given number of parallel processes to execute tests.  May decrease
 test run time substantially.  Defaults to %default.

Modified: zope.testing/branches/benji-parallelize-subprocesses/src/zope/testing/testrunner/runner.py
===================================================================
--- zope.testing/branches/benji-parallelize-subprocesses/src/zope/testing/testrunner/runner.py	2008-07-11 01:54:48 UTC (rev 88220)
+++ zope.testing/branches/benji-parallelize-subprocesses/src/zope/testing/testrunner/runner.py	2008-07-11 01:56:33 UTC (rev 88221)
@@ -223,7 +223,7 @@
                     break
 
             layers_to_run.pop(0)
-            if self.options.processes > 1:
+            if self.options.processes and self.options.processes > 1:
                 should_resume = True
                 break
 
@@ -464,8 +464,11 @@
     running_threads = []
     results_iter = iter(results)
     current_result = results_iter.next()
+    processes = 1
+    if options.processes is not None:
+        processes = options.processes
     while ready_threads or running_threads:
-        while len(running_threads) < options.processes and ready_threads:
+        while len(running_threads) < processes and ready_threads:
             thread = ready_threads.pop(0)
             thread.start()
             running_threads.append(thread)



More information about the Zope3-Checkins mailing list