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 <[email protected]>
Newsgroups gmane.comp.web.zope.zope3.cvs
Message-ID <20080711015633.E722739A07__22217.4348928549$1215741478$gmane$org@mail.zope.org>
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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.