[Zope3-checkins] SVN: zope.testing/trunk/ - fix test failure on Python 2.4 because of slight difference in the way

Benji York benji at zope.com
Mon Apr 13 11:43:40 EDT 2009


Log message for revision 99151:
  - fix test failure on Python 2.4 because of slight difference in the way
    coverage is reported (__init__ files with only a single comment line are now
    not reported)
  - fixed bug that caused the test runner to hang when running subprocesses (as a
    result Python 2.3 is no longer supported).
  - there is apparently a bug in Python 2.6 (related to
    http://bugs.python.org/issue1303673) that causes the profile tests to fail.
  - tests pass on Python 2.5
  - added explanitory notes to buildout.cfg about how to run the tests with
    multiple versions of Python
  - set trunk version to 3.7.2dev
  

Changed:
  U   zope.testing/trunk/CHANGES.txt
  U   zope.testing/trunk/buildout.cfg
  U   zope.testing/trunk/setup.py
  U   zope.testing/trunk/src/zope/testing/testrunner/runner.py
  U   zope.testing/trunk/src/zope/testing/testrunner/testrunner-coverage.txt
  U   zope.testing/trunk/src/zope/testing/testrunner/tests.py

-=-
Modified: zope.testing/trunk/CHANGES.txt
===================================================================
--- zope.testing/trunk/CHANGES.txt	2009-04-13 14:39:02 UTC (rev 99150)
+++ zope.testing/trunk/CHANGES.txt	2009-04-13 15:43:40 UTC (rev 99151)
@@ -1,12 +1,27 @@
 zope.testing Changelog
 **********************
 
+3.7.2 (2008-10-17)
+==================
+
+- fix test failure on Python 2.4 because of slight difference in the way
+  coverage is reported (__init__ files with only a single comment line are now
+  not reported)
+- fixed bug that caused the test runner to hang when running subprocesses (as a
+  result Python 2.3 is no longer supported).
+- there is apparently a bug in Python 2.6 (related to
+  http://bugs.python.org/issue1303673) that causes the profile tests to fail.
+- added explanitory notes to buildout.cfg about how to run the tests with
+  multiple versions of Python
+
+
 3.7.1 (2008-10-17)
 ==================
 
 - The setupstack temporary-directory support now properly handles
   read-only files by making them writable before removing them.
 
+
 3.7.0 (2008-09-22)
 ==================
 

Modified: zope.testing/trunk/buildout.cfg
===================================================================
--- zope.testing/trunk/buildout.cfg	2009-04-13 14:39:02 UTC (rev 99150)
+++ zope.testing/trunk/buildout.cfg	2009-04-13 15:43:40 UTC (rev 99151)
@@ -6,17 +6,29 @@
 recipe = zc.recipe.testrunner
 eggs = zope.testing
 
-[test23]
-python = python23
-recipe = zc.recipe.testrunner
-eggs = zope.testing
 
+# The [test2X] sections below are to make testing with various Python versions
+# easier.  You'll need entries in your default.cfg that point to the location
+# that your various versions of Python are installed.  Like so:
+#
+# [python2.4]
+# executable = /usr/local/bin/python2.4
+#
+# And then run "bin/buildout install test24 test25 test26" to build the
+# version-specific test scripts.  Once that's done you ran run "bin/test24"
+# (etc.).
+
 [test24]
-python = python24
+python = python2.4
 recipe = zc.recipe.testrunner
 eggs = zope.testing
 
 [test25]
-python = python25
+python = python2.5
 recipe = zc.recipe.testrunner
 eggs = zope.testing
+
+[test26]
+python = python2.6
+recipe = zc.recipe.testrunner
+eggs = zope.testing

Modified: zope.testing/trunk/setup.py
===================================================================
--- zope.testing/trunk/setup.py	2009-04-13 14:39:02 UTC (rev 99150)
+++ zope.testing/trunk/setup.py	2009-04-13 15:43:40 UTC (rev 99151)
@@ -79,7 +79,7 @@
 
 setup(
     name='zope.testing',
-    version='3.8.0dev',
+    version='3.7.2dev',
     url='http://pypi.python.org/pypi/zope.testing',
     license='ZPL 2.1',
     description='Zope testing framework, including the testrunner script.',

Modified: zope.testing/trunk/src/zope/testing/testrunner/runner.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/runner.py	2009-04-13 14:39:02 UTC (rev 99150)
+++ zope.testing/trunk/src/zope/testing/testrunner/runner.py	2009-04-13 15:43:40 UTC (rev 99151)
@@ -16,6 +16,12 @@
 $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 cStringIO
 import gc
 import glob
@@ -400,47 +406,30 @@
         for feature in features:
             feature.layer_setup(layer)
 
-        subin, subout, suberr = os.popen3(args)
-        while True:
-            try:
-                for line in subout:
-                    result.stdout.append(line)
-            except IOError, e:
-                if e.errno == errno.EINTR:
-                    # If the reading the subprocess input is interruped (as
-                    # be caused by recieving SIGCHLD), then retry.
-                    continue
-                options.output.error(
-                    "Error reading subprocess output for %s" % layer_name)
-                options.output.info(str(e))
-            else:
-                break
+        child = subprocess.Popen(args, shell=False, stdin=subprocess.PIPE,
+            stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
+        subout, suberr = child.communicate()
 
-        # The subprocess may have spewed any number of things to stderr, so
-        # we'll keep looking until we find the information we're looking for.
-        whole_suberr = ''
-        while True:
-            line = suberr.readline()
-            whole_suberr += line
-            if not line:
-                raise SubprocessError(
-                    'No subprocess summary found', repr(whole_suberr))
-
+        erriter = iter(suberr.splitlines())
+        for line in erriter:
             try:
                 result.num_ran, nfail, nerr = map(int, line.strip().split())
-                break
-            except KeyboardInterrupt:
-                raise
-            except:
+            except ValueError:
                 continue
+            else:
+                break
 
         while nfail > 0:
             nfail -= 1
-            failures.append((suberr.readline().strip(), None))
+            failures.append((erriter.next().strip(), None))
         while nerr > 0:
             nerr -= 1
-            errors.append((suberr.readline().strip(), None))
+            errors.append((erriter.next().strip(), None))
 
+
+#        result.stdout.extend(subout.splitlines())
+        result.stdout.append(subout)
+
     finally:
         result.done = True
 

Modified: zope.testing/trunk/src/zope/testing/testrunner/testrunner-coverage.txt
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/testrunner-coverage.txt	2009-04-13 14:39:02 UTC (rev 99150)
+++ zope.testing/trunk/src/zope/testing/testrunner/testrunner-coverage.txt	2009-04-13 15:43:40 UTC (rev 99151)
@@ -52,31 +52,7 @@
     Tearing down left over layers:
       Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
     lines   cov%   module   (path)
-        1   100%   sample1.__init__   (testrunner-ex/sample1/__init__.py)
-        1   100%   sample1.sample11.__init__   (testrunner-ex/sample1/sample11/__init__.py)
-       74    86%   sample1.sample11.sampletests   (testrunner-ex/sample1/sample11/sampletests.py)
-        1   100%   sample1.sample13.__init__   (testrunner-ex/sample1/sample13/__init__.py)
-       48   100%   sample1.sample13.sampletests   (testrunner-ex/sample1/sample13/sampletests.py)
-        1   100%   sample1.sampletests.__init__   (testrunner-ex/sample1/sampletests/__init__.py)
-       48   100%   sample1.sampletests.test1   (testrunner-ex/sample1/sampletests/test1.py)
-       74   100%   sample1.sampletests.test11   (testrunner-ex/sample1/sampletests/test11.py)
-       74   100%   sample1.sampletests.test111   (testrunner-ex/sample1/sampletests/test111.py)
-       74   100%   sample1.sampletests.test112   (testrunner-ex/sample1/sampletests/test112.py)
-       74   100%   sample1.sampletests.test12   (testrunner-ex/sample1/sampletests/test12.py)
-       74   100%   sample1.sampletests.test121   (testrunner-ex/sample1/sampletests/test121.py)
-       74   100%   sample1.sampletests.test122   (testrunner-ex/sample1/sampletests/test122.py)
-       48   100%   sample1.sampletests.test_one   (testrunner-ex/sample1/sampletests/test_one.py)
-       48   100%   sample1.sampletestsf   (testrunner-ex/sample1/sampletestsf.py)
-        1   100%   sample2.__init__   (testrunner-ex/sample2/__init__.py)
-        1   100%   sample2.sample21.__init__   (testrunner-ex/sample2/sample21/__init__.py)
-       48   100%   sample2.sample21.sampletests   (testrunner-ex/sample2/sample21/sampletests.py)
-        1   100%   sample2.sampletests.__init__   (testrunner-ex/sample2/sampletests/__init__.py)
-       48   100%   sample2.sampletests.test_1   (testrunner-ex/sample2/sampletests/test_1.py)
-       48   100%   sample2.sampletests.testone   (testrunner-ex/sample2/sampletests/testone.py)
-        1   100%   sample3.__init__   (testrunner-ex/sample3/__init__.py)
-       48   100%   sample3.sampletests   (testrunner-ex/sample3/sampletests.py)
-       84    85%   samplelayers   (testrunner-ex/samplelayers.py)
-        1   100%   sampletests.__init__   (testrunner-ex/sampletests/__init__.py)
+    ...
        48   100%   sampletests.test1   (testrunner-ex/sampletests/test1.py)
        74   100%   sampletests.test11   (testrunner-ex/sampletests/test11.py)
        74   100%   sampletests.test111   (testrunner-ex/sampletests/test111.py)

Modified: zope.testing/trunk/src/zope/testing/testrunner/tests.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/tests.py	2009-04-13 14:39:02 UTC (rev 99150)
+++ zope.testing/trunk/src/zope/testing/testrunner/tests.py	2009-04-13 15:43:40 UTC (rev 99151)
@@ -108,7 +108,8 @@
         optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
         checker=checker),
         doctest.DocTestSuite('zope.testing.testrunner'),
-        doctest.DocTestSuite('zope.testing.testrunner.coverage'),
+        doctest.DocTestSuite('zope.testing.testrunner.coverage',
+            optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE),
         doctest.DocTestSuite('zope.testing.testrunner.options'),
         doctest.DocTestSuite('zope.testing.testrunner.find'),
         ]



More information about the Zope3-Checkins mailing list