[Checkins] SVN: zope.testrunner/trunk/ merged branch to fix LP #719369 (handling of unexpected successes on Python 2.7)
Michael Howitz
mh at gocept.com
Mon Feb 21 07:07:42 EST 2011
Log message for revision 120492:
merged branch to fix LP #719369 (handling of unexpected successes on Python 2.7)
Changed:
U zope.testrunner/trunk/CHANGES.txt
U zope.testrunner/trunk/src/zope/testrunner/runner.py
A zope.testrunner/trunk/src/zope/testrunner/testrunner-ex-719369/
A zope.testrunner/trunk/src/zope/testrunner/testrunner-unexpected-success.txt
U zope.testrunner/trunk/src/zope/testrunner/tests.py
-=-
Modified: zope.testrunner/trunk/CHANGES.txt
===================================================================
--- zope.testrunner/trunk/CHANGES.txt 2011-02-21 11:26:01 UTC (rev 120491)
+++ zope.testrunner/trunk/CHANGES.txt 2011-02-21 12:07:42 UTC (rev 120492)
@@ -4,9 +4,13 @@
4.1.0 (unreleased)
==================
-- Nothing changed yet.
+- LP #719369: An `Unexpected success`_ (concept intruduced in Python 2.7) is
+ no longer handled as success but as failure. This is a workaround. The
+ whole unexpected success concept might be implemented later.
+.. _`Unexpected success`: http://www.voidspace.org.uk/python/articles/unittest2.shtml#more-skipping
+
4.0.0 (2010-10-19)
==================
Modified: zope.testrunner/trunk/src/zope/testrunner/runner.py
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/runner.py 2011-02-21 11:26:01 UTC (rev 120491)
+++ zope.testrunner/trunk/src/zope/testrunner/runner.py 2011-02-21 12:07:42 UTC (rev 120492)
@@ -675,6 +675,10 @@
class TestResult(unittest.TestResult):
+ # Handle unexpected success as failure:
+ # https://bugs.launchpad.net/zope.testrunner/+bug/719369
+ addUnexpectedSuccess = None
+
def __init__(self, options, tests, layer_name=None):
unittest.TestResult.__init__(self)
self.options = options
Copied: zope.testrunner/trunk/src/zope/testrunner/testrunner-unexpected-success.txt (from rev 120376, zope.testrunner/branches/icemac-lp-719369/src/zope/testrunner/testrunner-unexpected-success.txt)
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-unexpected-success.txt (rev 0)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-unexpected-success.txt 2011-02-21 12:07:42 UTC (rev 120492)
@@ -0,0 +1,42 @@
+testrunner handling of unexpected success
+=========================================
+
+Python 2.7 introduced the concept of expectedFailures to unittest.
+See http://www.voidspace.org.uk/python/articles/unittest2.shtml#more-skipping
+
+Although testrunner is currently not able to hande unexpected successes
+correctly at least it does not report them as successes.
+
+
+This document has some edge-case examples to test various aspects of
+the test runner.
+
+Separating Python path and test directories
+-------------------------------------------
+
+The --path option defines a directory to be searched for tests *and* a
+directory to be added to Python's search path. The --test-path option
+can be used when you want to set a test search path without also
+affecting the Python path:
+
+ >>> import os, sys
+ >>> directory_with_tests = os.path.join(this_directory, 'testrunner-ex-719369')
+
+ >>> from zope import testrunner
+
+ >>> defaults = [
+ ... '--path', directory_with_tests,
+ ... '--tests-pattern', '^sampletestsf?$',
+ ... ]
+ >>> sys.argv = ['test']
+ >>> testrunner.run_internal(defaults)
+ ... # doctest: +ELLIPSIS
+ Running zope.testrunner.layer.UnitTests tests:
+ Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
+ Failure in test test_ef (sampletestsf.TestUnexpectedSuccess)
+ Traceback (most recent call last):
+ _UnexpectedSuccess
+ Ran 1 tests with 1 failures and 0 errors in N.NNN seconds.
+ Tearing down left over layers:
+ Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
+ True
Modified: zope.testrunner/trunk/src/zope/testrunner/tests.py
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/tests.py 2011-02-21 11:26:01 UTC (rev 120491)
+++ zope.testrunner/trunk/src/zope/testrunner/tests.py 2011-02-21 12:07:42 UTC (rev 120492)
@@ -298,4 +298,12 @@
unittest.defaultTestLoader.loadTestsFromName(
'zope.testrunner.test_subunit'))
+ if sys.version_info[:3] > (2,7,0):
+ # Python 2.7 adds support for unittest.expectedFailure
+ suites.append(doctest.DocFileSuite(
+ 'testrunner-unexpected-success.txt',
+ setUp=setUp, tearDown=tearDown,
+ optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
+ checker=checker))
+
return unittest.TestSuite(suites)
More information about the checkins
mailing list