[Zope3-checkins] SVN: zope.testing/trunk/src/zope/testing/testrunner/ Rename subprocess module to process to avoid name clash with a global Python

Christian Theune ct at gocept.com
Fri Apr 24 02:48:43 EDT 2009


Log message for revision 99448:
  Rename subprocess module to process to avoid name clash with a global Python
  module.
  

Changed:
  A   zope.testing/trunk/src/zope/testing/testrunner/process.py
  U   zope.testing/trunk/src/zope/testing/testrunner/runner.py
  D   zope.testing/trunk/src/zope/testing/testrunner/subprocess.py

-=-
Copied: zope.testing/trunk/src/zope/testing/testrunner/process.py (from rev 99375, zope.testing/trunk/src/zope/testing/testrunner/subprocess.py)
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/process.py	                        (rev 0)
+++ zope.testing/trunk/src/zope/testing/testrunner/process.py	2009-04-24 06:48:42 UTC (rev 99448)
@@ -0,0 +1,44 @@
+##############################################################################
+#
+# Copyright (c) 2004-2008 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Subprocess support.
+
+$Id: __init__.py 86218 2008-05-03 14:17:26Z ctheune $
+"""
+
+import sys
+import time
+import zope.testing.testrunner.feature
+
+
+class SubProcess(zope.testing.testrunner.feature.Feature):
+    """Lists all tests in the report instead of running the tests."""
+
+    def __init__(self, runner):
+        super(SubProcess, self).__init__(runner)
+        self.active = bool(runner.options.resume_layer)
+
+    def global_setup(self):
+        self.original_stderr = sys.stderr
+        sys.stderr = sys.stdout
+        self.runner.options.verbose = False
+
+    def report(self):
+        sys.stdout.close()
+        # Communicate with the parent.  The protocol is obvious:
+        print >> self.original_stderr, self.runner.ran, \
+                len(self.runner.failures), len(self.runner.errors)
+        for test, exc_info in self.runner.failures:
+            print >> self.original_stderr, ' '.join(str(test).strip().split('\n'))
+        for test, exc_info in self.runner.errors:
+            print >> self.original_stderr, ' '.join(str(test).strip().split('\n'))


Property changes on: zope.testing/trunk/src/zope/testing/testrunner/process.py
___________________________________________________________________
Added: svn:mergeinfo
   + 
Added: svn:eol-style
   + native

Modified: zope.testing/trunk/src/zope/testing/testrunner/runner.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/runner.py	2009-04-24 04:46:53 UTC (rev 99447)
+++ zope.testing/trunk/src/zope/testing/testrunner/runner.py	2009-04-24 06:48:42 UTC (rev 99448)
@@ -16,11 +16,7 @@
 $Id: __init__.py 86232 2008-05-03 15:09:33Z ctheune $
 """
 
-# unfortunately there is a zope.testing.testrunner.subprocess module that we
-# need to avoid; also, we want to support Python 2.4, which doesn't have
-# # from __future__ import absolute_import, so we use a hack instead
-import imp
-subprocess = imp.load_module('subprocess', *imp.find_module('subprocess'))
+import subprocess
 
 import cStringIO
 import gc
@@ -49,7 +45,7 @@
 import zope.testing.testrunner.garbagecollection
 import zope.testing.testrunner.listing
 import zope.testing.testrunner.statistics
-import zope.testing.testrunner.subprocess
+import zope.testing.testrunner.process
 import zope.testing.testrunner.interfaces
 import zope.testing.testrunner.debug
 
@@ -193,7 +189,7 @@
             self.features.append(zope.testing.testrunner.garbagecollection.Debug(self))
 
         self.features.append(zope.testing.testrunner.find.Find(self))
-        self.features.append(zope.testing.testrunner.subprocess.SubProcess(self))
+        self.features.append(zope.testing.testrunner.process.SubProcess(self))
         self.features.append(zope.testing.testrunner.filter.Filter(self))
         self.features.append(zope.testing.testrunner.listing.Listing(self))
         self.features.append(zope.testing.testrunner.statistics.Statistics(self))

Deleted: zope.testing/trunk/src/zope/testing/testrunner/subprocess.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/subprocess.py	2009-04-24 04:46:53 UTC (rev 99447)
+++ zope.testing/trunk/src/zope/testing/testrunner/subprocess.py	2009-04-24 06:48:42 UTC (rev 99448)
@@ -1,44 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2008 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Subprocess support.
-
-$Id: __init__.py 86218 2008-05-03 14:17:26Z ctheune $
-"""
-
-import sys
-import time
-import zope.testing.testrunner.feature
-
-
-class SubProcess(zope.testing.testrunner.feature.Feature):
-    """Lists all tests in the report instead of running the tests."""
-
-    def __init__(self, runner):
-        super(SubProcess, self).__init__(runner)
-        self.active = bool(runner.options.resume_layer)
-
-    def global_setup(self):
-        self.original_stderr = sys.stderr
-        sys.stderr = sys.stdout
-        self.runner.options.verbose = False
-
-    def report(self):
-        sys.stdout.close()
-        # Communicate with the parent.  The protocol is obvious:
-        print >> self.original_stderr, self.runner.ran, \
-                len(self.runner.failures), len(self.runner.errors)
-        for test, exc_info in self.runner.failures:
-            print >> self.original_stderr, ' '.join(str(test).strip().split('\n'))
-        for test, exc_info in self.runner.errors:
-            print >> self.original_stderr, ' '.join(str(test).strip().split('\n'))



More information about the Zope3-Checkins mailing list