[Jython-checkins] jython: Merge in changes from latest doctest.py
frank.wierzbicki
jython-checkins at python.org
Mon Mar 11 18:23:46 CET 2013
http://hg.python.org/jython/rev/41371e4cf9f4
changeset: 7077:41371e4cf9f4
user: Frank Wierzbicki <fwierzbicki at gmail.com>
date: Sun Mar 10 10:16:30 2013 -0700
summary:
Merge in changes from latest doctest.py
files:
Lib/doctest.py | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/Lib/doctest.py b/Lib/doctest.py
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -2318,7 +2318,8 @@
return "Doctest: " + self._dt_test.name
class SkipDocTestCase(DocTestCase):
- def __init__(self):
+ def __init__(self, module):
+ self.module = module
DocTestCase.__init__(self, None)
def setUp(self):
@@ -2328,7 +2329,10 @@
pass
def shortDescription(self):
- return "Skipping tests from %s" % module.__name__
+ return "Skipping tests from %s" % self.module.__name__
+
+ __str__ = shortDescription
+
def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
**options):
@@ -2376,12 +2380,17 @@
if not tests and sys.flags.optimize >=2:
# Skip doctests when running with -O2
suite = unittest.TestSuite()
- suite.addTest(SkipDocTestCase())
+ suite.addTest(SkipDocTestCase(module))
return suite
elif not tests:
# Why do we want to do this? Because it reveals a bug that might
# otherwise be hidden.
- raise ValueError(module, "has no tests")
+ # It is probably a bug that this exception is not also raised if the
+ # number of doctest examples in tests is zero (i.e. if no doctest
+ # examples were found). However, we should probably not be raising
+ # an exception at all here, though it is too late to make this change
+ # for a maintenance release. See also issue #14649.
+ raise ValueError(module, "has no docstrings")
tests.sort()
suite = unittest.TestSuite()
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list