summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-09-14 17:17:37 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-09-14 17:17:37 +0000
commit933cda3749865b0c776a21b39076c500ddcbe12f (patch)
treeed464efabc620c114a4defa50594f11eecc70b8c
parent42f4f44356044ee57b7efd32a423c01e2b9454bc (diff)
Fixed #5442 -- Added Jython workaround in django.test._doctest. Thanks, leo.soto@gmail.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6194 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/test/_doctest.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/django/test/_doctest.py b/django/test/_doctest.py
index 8777a2cbba..3589e16225 100644
--- a/django/test/_doctest.py
+++ b/django/test/_doctest.py
@@ -1,5 +1,5 @@
# This is a slightly modified version of the doctest.py that shipped with Python 2.4
-# It incorporates changes that have been submitted the the Python ticket tracker
+# It incorporates changes that have been submitted the the Python ticket tracker
# as ticket #1521051. These changes allow for a DoctestRunner and Doctest base
# class to be specified when constructing a DoctestSuite.
@@ -105,6 +105,14 @@ import unittest, difflib, pdb, tempfile
import warnings
from StringIO import StringIO
+if sys.platform.startswith('java'):
+ # On Jython, isclass() reports some modules as classes. Patch it.
+ def patch_isclass(isclass):
+ def patched_isclass(obj):
+ return isclass(obj) and hasattr(obj, '__module__')
+ return patched_isclass
+ inspect.isclass = patch_isclass(inspect.isclass)
+
# Don't whine about the deprecated is_private function in this
# module's tests.
warnings.filterwarnings("ignore", "is_private", DeprecationWarning,